Skip to content

Commit

Permalink
test: relax timing constraints for child process
Browse files Browse the repository at this point in the history
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: nodejs/node-v0.x-archive#25291
  • Loading branch information
gireeshpunathil authored and mhdawson committed May 14, 2015
1 parent 97d4706 commit ebbb356
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/simple/test-child-process-spawnsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var ret = spawnSync('sleep', ['1']);
var stop = process.hrtime(start);
assert.strictEqual(ret.status, 0, 'exit status should be zero');
console.log('sleep exited', stop);
assert.strictEqual(stop[0], 1, 'sleep should not take longer or less than 1 second');
assert.ok(stop[0] >= 1, 'sleep should not take less than 1 second');

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

0 comments on commit ebbb356

Please sign in to comment.