Skip to content

Commit fa152f7

Browse files
committed
test: raise sleep times in child process tests
sequential/test-child-process-execsync and parallel/test-child-process-spawnsync-timeout are both flaky on azure Windows machines, where it may take longer for Node.js to launch and receive output from child processes. These tests work by spawning a child processes that is supposed to sleep for a long time, but the option is configured so that Node.js would terminate them early when a shorter timeout is reached. Then the tests assert that the time taken for the whole thing is shorter than the specified sleep time (meaning the process don't actually get to sleep for that long). To make the tests less brittle on azure Windows, this patch raises the sleep times in those tests on Windows platform, so that the overhead can be taken into account there. PR-URL: nodejs#44375 Refs: nodejs/build#3014 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]>
1 parent b29dd38 commit fa152f7

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

test/parallel/test-child-process-spawnsync-timeout.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ const { debuglog, getSystemErrorName } = require('util');
2828
const debug = debuglog('test');
2929

3030
const TIMER = 200;
31-
const SLEEP = common.platformTimeout(5000);
31+
let SLEEP = common.platformTimeout(5000);
32+
33+
if (common.isWindows) {
34+
// Some of the windows machines in the CI need more time to launch
35+
// and receive output from child processes.
36+
// https://github.com/nodejs/build/issues/3014
37+
SLEEP = common.platformTimeout(15000);
38+
}
3239

3340
switch (process.argv[2]) {
3441
case 'child':

test/sequential/test-child-process-execsync.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ const { execFileSync, execSync, spawnSync } = require('child_process');
3030
const { getSystemErrorName } = require('util');
3131

3232
const TIMER = 200;
33-
const SLEEP = 2000;
33+
let SLEEP = 2000;
34+
if (common.isWindows) {
35+
// Some of the windows machines in the CI need more time to launch
36+
// and receive output from child processes.
37+
// https://github.com/nodejs/build/issues/3014
38+
SLEEP = 10000;
39+
}
3440

3541
const execOpts = { encoding: 'utf8', shell: true };
3642

0 commit comments

Comments
 (0)