Skip to content
Permalink
Browse files

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>
  • Loading branch information...
joyeecheung authored and rvagg committed Feb 19, 2019
1 parent fde4011 commit cd10e25bd68f4214370ff6c37f221dea59095b73
Showing with 6 additions and 6 deletions.
  1. +6 −6 test/{pummel → parallel}/test-process-uptime.js
@@ -24,14 +24,14 @@ require('../common');
const assert = require('assert');

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

const original = process.uptime();

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

0 comments on commit cd10e25

Please sign in to comment.
You can’t perform that action at this time.