From ebbb3560fabc757b06efa4caff07b2ab4b68b5ba Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Wed, 13 May 2015 01:35:44 -0400 Subject: [PATCH] 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 PR-URL: https://github.com/joyent/node/pull/25291 --- test/simple/test-child-process-spawnsync.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simple/test-child-process-spawnsync.js b/test/simple/test-child-process-spawnsync.js index a7cbb8d1df..4ed29646dd 100644 --- a/test/simple/test-child-process-spawnsync.js +++ b/test/simple/test-child-process-spawnsync.js @@ -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');