Skip to content
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

Merged
merged 1 commit into from
May 11, 2024
Merged

Conversation

psj-tar-gz
Copy link
Contributor

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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. test Issues and PRs related to the tests. labels Aug 29, 2020
@Flarna
Copy link
Member

Flarna commented Sep 4, 2020

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 }, () => {
Copy link
Member

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.)

@addaleax addaleax added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 5, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 5, 2020
@nodejs-github-bot

This comment has been minimized.

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Nov 8, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 8, 2020
@nodejs-github-bot
Copy link
Collaborator

@Flarna
Copy link
Member

Flarna commented Nov 9, 2020

@psj-tar-gz Linter complains about a few findings. A rebase to current master is maybe also a good idea.

@aduh95 aduh95 removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 9, 2020
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 force-pushed the psj-dev branch 2 times, most recently from 4de4483 to 55f0830 Compare May 5, 2024 21:24
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 5, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

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>
@aduh95
Copy link
Contributor

aduh95 commented May 11, 2024

Landed in 491855c

@aduh95 aduh95 merged commit 491855c into nodejs:main May 11, 2024
39 checks passed
targos pushed a commit that referenced this pull request May 11, 2024
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>
lukins-cz pushed a commit to lukins-cz/OS-Aplet-node that referenced this pull request Jun 1, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants