Skip to content

C# integration tests - #182

Merged
erunion merged 59 commits into
mainfrom
csharp-integration-tests
Jun 23, 2023
Merged

erunion merged 59 commits into
mainfrom
csharp-integration-tests

Conversation

@llimllib

@llimllib llimllib commented Jun 17, 2023 •

Copy link
Copy Markdown

🧰 Changes

  • dockerignore node_modules
    • this decreases by a lot the amount of context that docker has to send to the container, speeding up iteration
  • add a csharp integration test workflow
  • refactor the integration tests a tiny bit
  • add a csharp docker file and docker-compose service
  • modify fixtures to pass
  • minor improvements to the restsharp client
    • set a content-type if there's no body to submit
    • add a newline at the end of the file
  • add a cli key to the csharp target

🧬 QA & Testing

Provide as much information as you can on how to test what you've done.

Comment thread src/integration.test.ts
// there to be only one file with top-level code in any project, so we'll
// keep this project around but copy each fixture in as Program.cs
// - run Program.cs and return the output
shell.execSync(`cp ${fixturePath} /src/IntTestCsharp/Program.cs`);

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input

This string concatenation which depends on [library input](1) is later used in a [shell command](2).
Comment thread src/integration.test.ts
request: Request
) {
test(`should return the expected response for \`${fixture}\``, () => {
const basePath = path.join('src', 'targets', targetId, clientId, 'fixtures', `${fixture}${extname(targetId)}`);

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input

This path concatenation which depends on [library input](1) is later used in a [shell command](2).
Comment thread src/integration.test.ts
// there to be only one file with top-level code in any project, so we'll
// keep this project around but copy each fixture in as Program.cs
// - run Program.cs and return the output
shell.execSync(`cp ${fixturePath} /src/IntTestCsharp/Program.cs`);

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [file name](1).
Comment thread src/integration.test.ts
if (EXEC_FUNCTION[targetId]) {
stdout = EXEC_FUNCTION[targetId](basePath);
} else {
stdout = shell.execSync(format(targetCLI, basePath));

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [file name](1).
llimllib added 12 commits June 17, 2023 12:20
- go-httpbin is using my local tag bc of mccutchen/go-httpbin#123
- go-httpbin incorrectly thinks our requests are coming in on plain http. Possibly https://stackoverflow.com/a/61446922 is the answer?
- getting close
.json() will parse the output _out_ of json and print it
as a python object, which our integration tests cannot
then parse
@llimllib
llimllib marked this pull request as ready for review June 22, 2023 17:10
@llimllib
llimllib changed the base branch from main to local-httpbin June 22, 2023 17:16
Base automatically changed from local-httpbin to main June 23, 2023 02:16
@llimllib
llimllib requested a review from erunion June 23, 2023 02:34

@erunion erunion left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next one's on me 🍻

@erunion
erunion merged commit 72ea746 into main Jun 23, 2023
@erunion
erunion deleted the csharp-integration-tests branch June 23, 2023 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants