-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
test: add http agent to executionAsyncResource #34966
Conversation
Isn't it needed to execute at least two http requests to the same server to see the diff between use of the dedicated agent versus the global agent? |
server.listen(0, () => { | ||
assert.strictEqual(executionAsyncResource(), hooked[executionAsyncId()]); | ||
|
||
http.get({ agent, port: server.address().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.
Can you wrap all the callbacks that are supposed to be called exactly once in common.mustCall()
, i.e. the ones to http.createServer()
, server.listen()
and http.get()
? That ensures that the assertions here are actually run, instead of the test just passing because something led to the callbacks not being called. (That’s probably not going to realistically happen because a ton of other tests would fail is these things were broken, but it’s a good practice to add those checks in our tests.)
This comment has been minimized.
This comment has been minimized.
@psj-tar-gz Linter complains about a few findings. A rebase to current master is maybe also a good idea. |
4de4483
to
55f0830
Compare
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: nodejs#34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 491855c |
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: #34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: #34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: #34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: #34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: nodejs#34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Refs: https://github.com/nodejs/node/blob/HEAD/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <lyricalllmagical@gmail.com> PR-URL: nodejs#34966 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
I added a testcase about executionAsyncResource with Http Agent.
Refs: https://github.com/nodejs/node/blob/master/test/async-hooks/test-async-exec-resource-http.js
Signed-off-by: psj-tar-gz lyricalllmagical@gmail.com
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes