-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
test: skip setPriority
test if insufficient permissions
#55863
base: main
Are you sure you want to change the base?
Conversation
I'm not sure this is correct approach. According to NixOS/nixpkgs#355919 (comment), the issue in NixOS happened without having a094a81? In this case, it would make sense to try cherry-picking a094a81 itself because it fixes |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #55863 +/- ##
==========================================
- Coverage 88.41% 88.41% -0.01%
==========================================
Files 654 654
Lines 187811 187852 +41
Branches 36134 36130 -4
==========================================
+ Hits 166059 166092 +33
- Misses 14992 15002 +10
+ Partials 6760 6758 -2 |
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.
Works on NixOS
@nodejs/fs can I get some reviews please? |
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.
Not blocking it as-is, since there are platforms that do not allow setting lower priority (which is IMHO a bug, i don't see why it should be restricted intentionally), and assuming unbreaking their build being urgent.
But if we ignore EACCES
, it's better to remove this part of test completely, because it's already covered by test-os-process-priority.js.
if (!common.isIBMi) { | ||
const { PRIORITY_BELOW_NORMAL, PRIORITY_LOW } = os.constants.priority; | ||
const LOWER_PRIORITY = os.getPriority() > PRIORITY_BELOW_NORMAL ? PRIORITY_BELOW_NORMAL : PRIORITY_LOW; |
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.
if (!common.isIBMi) { | |
const { PRIORITY_BELOW_NORMAL, PRIORITY_LOW } = os.constants.priority; | |
const LOWER_PRIORITY = os.getPriority() > PRIORITY_BELOW_NORMAL ? PRIORITY_BELOW_NORMAL : PRIORITY_LOW; |
try { | ||
os.setPriority(LOWER_PRIORITY); | ||
const priority = os.getPriority(); | ||
is.number(priority); | ||
assert.strictEqual(priority, LOWER_PRIORITY); | ||
} catch (err) { | ||
// The current user might not have sufficient permissions to set this | ||
// specific priority level. | ||
if (err?.info?.code !== 'EACCES') throw err; | ||
} | ||
} |
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.
try { | |
os.setPriority(LOWER_PRIORITY); | |
const priority = os.getPriority(); | |
is.number(priority); | |
assert.strictEqual(priority, LOWER_PRIORITY); | |
} catch (err) { | |
// The current user might not have sufficient permissions to set this | |
// specific priority level. | |
if (err?.info?.code !== 'EACCES') throw err; | |
} | |
} |
Fixes: NixOS/nixpkgs#355919