Skip to content

Commit de84249

Browse files
Trottaddaleax
authored andcommittedJul 18, 2017
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: #14134 Fixes: #14133 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent e879a56 commit de84249

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed
 

‎test/parallel/test-http-set-timeout-server.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ function run() {
4242
}
4343

4444
test(function serverTimeout(cb) {
45-
const server = http.createServer(common.mustCall((req, res) => {
46-
// just do nothing, we should get a timeout event.
47-
}));
45+
const server = http.createServer((req, res) => {
46+
// Do nothing. We should get a timeout event.
47+
// Might not be invoked. Do not wrap in common.mustCall().
48+
});
4849
server.listen(common.mustCall(() => {
4950
const s = server.setTimeout(50, common.mustCall((socket) => {
5051
socket.destroy();

‎test/sequential/test-https-set-timeout-server.js ‎test/parallel/test-https-set-timeout-server.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ function run() {
5454
test(function serverTimeout(cb) {
5555
const server = https.createServer(
5656
serverOptions,
57-
common.mustCall((req, res) => {
58-
// just do nothing, we should get a timeout event.
59-
}));
57+
(req, res) => {
58+
// Do nothing. We should get a timeout event.
59+
// Might not be invoked. Do not wrap in common.mustCall().
60+
});
6061
server.listen(common.mustCall(() => {
6162
const s = server.setTimeout(50, common.mustCall((socket) => {
6263
socket.destroy();

0 commit comments

Comments
 (0)