Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit ebbb356

Browse files
gireeshpunathilmhdawson
authored andcommitted
test: relax timing constraints for child process
With additional load in the system, the child process which runs sleep command takes more time to run - typically slightly above 1 second, but above 2 seconds under stress. While the intent of the test is to test the functionality of spawnSync and the child process in general, in effect it is testing the system command sleep, and further, it's responsiveness. Since from the name the purpose of the test seems to be unrelated to the sleep behaviour, I believe a more meaningful assertion would be to see the time taken is more than 1 second. Reviewed-By: Michael Dawson <[email protected]> PR-URL: #25291
1 parent 97d4706 commit ebbb356

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/simple/test-child-process-spawnsync.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var ret = spawnSync('sleep', ['1']);
4141
var stop = process.hrtime(start);
4242
assert.strictEqual(ret.status, 0, 'exit status should be zero');
4343
console.log('sleep exited', stop);
44-
assert.strictEqual(stop[0], 1, 'sleep should not take longer or less than 1 second');
44+
assert.ok(stop[0] >= 1, 'sleep should not take less than 1 second');
4545

4646
// Error test when command does not exist
4747
var ret_err = spawnSync('command_does_not_exist');

0 commit comments

Comments
 (0)