test: fix flaky test-https-set-timeout-server
Because of a race condition, connection listener may not be invoked if test is run under load. Remove `common.mustCall()` wrapper from the listener. Move the test to `parallel` because it now works under load. Make similar change to http test to keep them in synch even though it is much harder to trigger the race in http. PR-URL: https://github.com/nodejs/node/pull/14134 Fixes: https://github.com/nodejs/node/issues/14133 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
parent
22889347df
commit
b20a0b662b
@ -42,9 +42,10 @@ function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test(function serverTimeout(cb) {
|
test(function serverTimeout(cb) {
|
||||||
const server = http.createServer(common.mustCall((req, res) => {
|
const server = http.createServer((req, res) => {
|
||||||
// just do nothing, we should get a timeout event.
|
// Do nothing. We should get a timeout event.
|
||||||
}));
|
// Might not be invoked. Do not wrap in common.mustCall().
|
||||||
|
});
|
||||||
server.listen(common.mustCall(() => {
|
server.listen(common.mustCall(() => {
|
||||||
const s = server.setTimeout(50, common.mustCall((socket) => {
|
const s = server.setTimeout(50, common.mustCall((socket) => {
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
@ -54,9 +54,10 @@ function run() {
|
|||||||
test(function serverTimeout(cb) {
|
test(function serverTimeout(cb) {
|
||||||
const server = https.createServer(
|
const server = https.createServer(
|
||||||
serverOptions,
|
serverOptions,
|
||||||
common.mustCall((req, res) => {
|
(req, res) => {
|
||||||
// just do nothing, we should get a timeout event.
|
// Do nothing. We should get a timeout event.
|
||||||
}));
|
// Might not be invoked. Do not wrap in common.mustCall().
|
||||||
|
});
|
||||||
server.listen(common.mustCall(() => {
|
server.listen(common.mustCall(() => {
|
||||||
const s = server.setTimeout(50, common.mustCall((socket) => {
|
const s = server.setTimeout(50, common.mustCall((socket) => {
|
||||||
socket.destroy();
|
socket.destroy();
|
Loading…
x
Reference in New Issue
Block a user