test: ensure that test priority is not higher than current priority

PR-URL: https://github.com/nodejs/node/pull/55739
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Livia Medeiros
2024-11-08 19:39:11 +09:00
committed by GitHub
parent 765f16c442
commit a094a8166c

View File

@@ -83,11 +83,12 @@ assert.ok(hostname.length > 0);
// IBMi process priority is different.
if (!common.isIBMi) {
const DUMMY_PRIORITY = 10;
os.setPriority(DUMMY_PRIORITY);
const { PRIORITY_BELOW_NORMAL, PRIORITY_LOW } = os.constants.priority;
const LOWER_PRIORITY = os.getPriority() > PRIORITY_BELOW_NORMAL ? PRIORITY_BELOW_NORMAL : PRIORITY_LOW;
os.setPriority(LOWER_PRIORITY);
const priority = os.getPriority();
is.number(priority);
assert.strictEqual(priority, DUMMY_PRIORITY);
assert.strictEqual(priority, LOWER_PRIORITY);
}
// On IBMi, os.uptime() returns 'undefined'