From 48bb6cdaa04d48a7a444918ced3ee97139c45d4f Mon Sep 17 00:00:00 2001 From: Livia Medeiros Date: Fri, 8 Nov 2024 19:39:11 +0900 Subject: [PATCH] test: ensure that test priority is not higher than current priority PR-URL: https://github.com/nodejs/node/pull/55739 Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel --- test/parallel/test-os.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index f7059260ce507e..efaec2b3ead385 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -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'