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: https://github.com/nodejs/node/pull/44375
Refs: https://github.com/nodejs/build/issues/3014
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
This commit is contained in:
Joyee Cheung authored and Juan José Arboleda committed 2022-10-11 14:45:18 -05:00
1 parent c35a0713b0
commit 6990833a4c
2 files changed
+15 -2

No files matched your search

@@ -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':
@@ -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 };