-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process: fix calculation in process.uptime() #26206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process: move test-process-uptime to pummel
^ should this read to parallel
?
test/parallel/test-process-uptime.js
Outdated
assert.ok(uptime <= original + 3); | ||
}, 2000); | ||
assert.ok(original < uptime); | ||
}, common.platformTimeout(100)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to use common.platformTimeout()
at all if all we're checking is original < uptime
. For that matter, this can probably use a value more like 5
than 100
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. (OK by me if my one comment/nit is ignored.)
56f1e5c
to
ae991b2
Compare
Yes. (This is what happens when I stay up at 2am 🤦♀️ ) Updated the test description and the timeout. |
In nodejs#26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: nodejs#26016
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.
Tiny lint error: |
test/parallel/test-process-uptime.js
Outdated
@@ -20,18 +20,18 @@ | |||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
|
|||
'use strict'; | |||
require('../common'); | |||
const common = require('../common'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const common = require('../common'); | |
require('../common'); |
I'd like to fast-track this (to fix the failing test), but it's 3AM in China, so I'm going to push the tiny lint fix and re-run CI. |
Please 👍 here if you support fast-tracking. @addaleax @richardlau |
Landed in 129516d...5c9b37b. Thanks, @joyeecheung! 🎉 |
In nodejs#26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: nodejs#26016 PR-URL: nodejs#26206 Fixes: nodejs#26205 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
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: nodejs#26206 Fixes: nodejs#26205 Refs: nodejs#26016 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
In #26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: #26016 PR-URL: #26206 Fixes: #26205 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
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>
In #26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: #26016 PR-URL: #26206 Fixes: #26205 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
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>
process: fix calculation in process.uptime()
In #26016 the result returned
by process.uptime() was mistakenly set to be based in the wrong
unit. This patch fixes the calculation and makes sure the returned
value is in seconds.
Refs: #26016
Fixes: #26205
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.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes