Skip to content

Commit cd10e25

Browse files
joyeecheungrvagg
authored andcommitted
process: move test-process-uptime to parallel
In addition, do not make too many assumptions about the startup time and timer latency in test-process-uptime. Instead only test that the value is likely in the correct unit (seconds) and it should be increasing in subsequent calls. PR-URL: #26206 Fixes: #26205 Refs: #26016 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent fde4011 commit cd10e25

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/pummel/test-process-uptime.js test/parallel/test-process-uptime.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ require('../common');
2424
const assert = require('assert');
2525

2626
console.error(process.uptime());
27-
assert.ok(process.uptime() <= 2);
27+
// Add some wiggle room for different platforms.
28+
// Verify that the returned value is in seconds -
29+
// 15 seconds should be a good estimate.
30+
assert.ok(process.uptime() <= 15);
2831

2932
const original = process.uptime();
3033

3134
setTimeout(function() {
3235
const uptime = process.uptime();
33-
// some wiggle room to account for timer
34-
// granularity, processor speed, and scheduling
35-
assert.ok(uptime >= original + 2);
36-
assert.ok(uptime <= original + 3);
37-
}, 2000);
36+
assert.ok(original < uptime);
37+
}, 10);

0 commit comments

Comments
 (0)