-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
test: fix flaky addons/callback-scope/test-resolve-async #22664
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
|
CI: https://ci.nodejs.org/job/node-test-pull-request/16968/ Feel free to 👍 this comment if you approve of fast-tracking. |
lundibundi
left a comment
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.
LGTM. Whoever lands this please also add
Fixes: https://github.com/nodejs/node/issues/22668.
081f134 to
f6e012b
Compare
f6e012b to
b85baf7
Compare
|
Okay, loosened the test a bit more here. New CI: https://ci.nodejs.org/job/node-test-pull-request/16987/ (:heavy_check_mark:) |
| testResolveAsync().then(() => { called = true; }); | ||
|
|
||
| setTimeout(() => { assert(called); }, common.platformTimeout(50)); | ||
| process.on('beforeExit', () => { assert(called); }); |
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 not use common.mustCall? It uses essentially the same mechanism
Lines 428 to 429 in b85baf7
| // add the exit listener only once to avoid listener leak warnings | |
| if (mustCallChecks.length === 0) process.on('exit', runCallChecks); |
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.
The goal is to have no MakeCallback() calls coming from Node.js before the check is run, since those would also run the microtask queue. process.on('exit') would be too late for that, process.on('beforeExit') should be okay.
|
Landed in 4a5886c. |
Fixes: #22668 PR-URL: #22664 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Fixes: #22668 PR-URL: #22664 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Example failure: https://ci.nodejs.org/job/node-test-commit-linux/21264/nodes=fedora-latest-x64/console
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes