-
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: fix flaky test-http-client-timeout-option-with-agent #22403
Conversation
There is no guarantee that a timeout won't be delayed considerably due to unrelated activity on the host. Instead of checking that the timeout happens within a certain tolerance, simply check that it did not happen too soon. Fixes: nodejs#22041
(Fixes: Investigate flaky test-http-client-timeout-option-with-agent #22041) |
@nodejs/testing |
// some number of milliseconds, so test it in second units. | ||
assert.strictEqual(duration / 1000 | 0, HTTP_CLIENT_TIMEOUT / 1000); | ||
// some number of milliseconds. | ||
assert.ok(duration >= HTTP_CLIENT_TIMEOUT, |
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 think a timeout can expire a little sooner than the specified delay so I'm not sure this resolves the flakiness.
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 think a timeout can expire a little sooner than the specified delay so I'm not sure this resolves the flakiness.
AFAIK it can't, at least not at the millisecond resolution.
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.
It seems this has been fixed in #20555 as per
#10154 (comment).
assert.strictEqual(duration / 1000 | 0, HTTP_CLIENT_TIMEOUT / 1000); | ||
// some number of milliseconds. | ||
assert.ok(duration >= HTTP_CLIENT_TIMEOUT, | ||
`${duration} < ${HTTP_CLIENT_TIMEOUT}`); |
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.
Maybe actual duration ${duration}ms was less than expected ${HTTP_CLIENT_TIMEOUT}ms.
b832020
to
4475597
Compare
CI after applying nit from @refack: https://ci.nodejs.org/job/node-test-pull-request/16583/ |
I think git no like the change-after-rename:
P.S. if gets hairy, just ignore my nit. |
test-http-client-timeout-option-with-agent no longer checks that the timeout happens within a certain tolerance so it can be moved to the parallel test suite.
@refack Yikes! Fixed. |
Resume: https://ci.nodejs.org/job/node-test-commit/20741/ |
Please 👍 here to fast-track. |
There is no guarantee that a timeout won't be delayed considerably due to unrelated activity on the host. Instead of checking that the timeout happens within a certain tolerance, simply check that it did not happen too soon. Fixes: nodejs#22041 PR-URL: nodejs#22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
test-http-client-timeout-option-with-agent no longer checks that the timeout happens within a certain tolerance so it can be moved to the parallel test suite. PR-URL: nodejs#22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in b1e2612...36696cf |
There is no guarantee that a timeout won't be delayed considerably due to unrelated activity on the host. Instead of checking that the timeout happens within a certain tolerance, simply check that it did not happen too soon. Fixes: #22041 PR-URL: #22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
test-http-client-timeout-option-with-agent no longer checks that the timeout happens within a certain tolerance so it can be moved to the parallel test suite. PR-URL: #22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
There is no guarantee that a timeout won't be delayed considerably due to unrelated activity on the host. Instead of checking that the timeout happens within a certain tolerance, simply check that it did not happen too soon. Fixes: #22041 PR-URL: #22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
test-http-client-timeout-option-with-agent no longer checks that the timeout happens within a certain tolerance so it can be moved to the parallel test suite. PR-URL: #22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #22403 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
First commit:
Second commit:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes