Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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: #44375
Refs: nodejs/build#3014
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
  • Loading branch information
joyeecheung committed Sep 6, 2022
commit a897b500710b72efeda87ae0fd44f62f4c1ade15
9 changes: 8 additions & 1 deletion test/parallel/test-child-process-spawnsync-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ const { debuglog, getSystemErrorName } = require('util');
const debug = debuglog('test');

const TIMER = 200;
const SLEEP = common.platformTimeout(5000);
let SLEEP = common.platformTimeout(5000);

if (common.isWindows) {
// Some of the windows machines in the CI need more time to launch
// and receive output from child processes.
// https://github.com/nodejs/build/issues/3014
SLEEP = common.platformTimeout(15000);
}

switch (process.argv[2]) {
case 'child':
Expand Down
8 changes: 7 additions & 1 deletion test/sequential/test-child-process-execsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ const { execFileSync, execSync, spawnSync } = require('child_process');
const { getSystemErrorName } = require('util');

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

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

Expand Down