Skip to content

Add tests for convertRequest (NodeJS sSDK runtime). #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

pose
Copy link
Contributor

@pose pose commented Mar 6, 2023

Description of changes: Adding tests for convertRequest method for server-node runtime.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pose pose requested review from a team as code owners March 6, 2023 18:11
@pose pose force-pushed the features/convert-request-tests branch from e54dc85 to 28bfba0 Compare March 6, 2023 18:23
resToEnd = res;
});
// Create a temporary named pipe where to run the server and obtain a request
socketPath = path.join(await mkdtemp(path.join(os.tmpdir(), "named-pipe-for-test-")), "server");

Choose a reason for hiding this comment

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

Why listen to a socket rather than a port? port 0 would bind to any free port.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a huge fan of tests that depend on the TCP stack in general (probably since I have had clash with already used ports many times). It's also true that I can bind to the socket (as you describe) and it's probably going to be still quite fast. Do you think I'm losing performance or how realistic is the scenario under test?

server?.close();
});

async function streamToString(stream: Readable) {

Choose a reason for hiding this comment

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

@aws-sdk/node-http-handler streamCollector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I see the following caveats:

  • It returns a Uint8Array which I still need to convert to String.
  • I'm introducing a new dependency @aws-sdk/node-http-handler only for this.

@kuhe what do you think?

@srchase srchase merged commit f25c48e into smithy-lang:main Mar 10, 2023
@pose pose deleted the features/convert-request-tests branch March 10, 2023 19:59
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
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.

4 participants