-
Notifications
You must be signed in to change notification settings - Fork 105
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
Conversation
e54dc85
to
28bfba0
Compare
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"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
Co-authored-by: Alberto Pose <[email protected]>
Description of changes: Adding tests for
convertRequest
method forserver-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.