-
Notifications
You must be signed in to change notification settings - Fork 30k
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 #23811
test: fix flaky test #23811
Conversation
server.close(); | ||
} | ||
|
||
setImmediate(makeRemainingRequests); |
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.
Nit: I think we can simply call the function as it will just postpone itself anyway.
This commit fixes test-tls-set-secure-context.js. The test was making one long lasting HTTP connection, followed by a number of shorter lived connections. However, it was possible that the connections were not received in the desired order. This commit ensures that the long lasting connection is established before making any other connections.
async function makeRemainingRequests() { | ||
// Wait until the first request is guaranteed to have been handled. | ||
if (!firstResponse) { | ||
return setImmediate(makeRemainingRequests); |
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 we use a dummy EventEmitter to emit an event when firstResponse
is set instead of polling for it and call makeRemainingRequests
when the event is emitted?
This commit fixes test-tls-set-secure-context.js. The test was making one long lasting HTTP connection, followed by a number of shorter lived connections. However, it was possible that the connections were not received in the desired order. This commit ensures that the long lasting connection is established before making any other connections. PR-URL: nodejs#23811 Fixes: nodejs#23807 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in b794f58. @lpinca Regarding your comment: Nit that can be ignored? Or something that should be done in a subsequent PR? If more than a nit, you'll open the PR? |
Yes, it can be ignored or addressed in another PR. Thank you. |
This commit fixes test-tls-set-secure-context.js. The test was making one long lasting HTTP connection, followed by a number of shorter lived connections. However, it was possible that the connections were not received in the desired order. This commit ensures that the long lasting connection is established before making any other connections. PR-URL: #23811 Fixes: #23807 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit fixes
test-tls-set-secure-context.js
. The test was making one long lasting HTTP connection, followed by a number of shorter lived connections. However, it was possible that the connections were not received in the desired order. This commit ensures that the long lasting connection is established before making any other connections.Fixes: #23807
Before this change, the command
tools/test.py -j 8 --repeat 1000 test/parallel/test-tls-set-secure-context.js
failed approximately 1% of the time for me locally. With this change, I haven't seen a failure after two such runs.cc: @targos
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes