test: skip setPriority test if insufficient permissions#55863
test: skip setPriority test if insufficient permissions#55863aduh95 wants to merge 1 commit intonodejs:mainfrom
setPriority test if insufficient permissions#55863Conversation
|
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
|
|
@nodejs/fs can I get some reviews please? |
LiviaMedeiros
left a comment
There was a problem hiding this comment.
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.
| 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.
| 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; | |
| } | |
| } |
|
Superseded by #55908 |
Fixes: NixOS/nixpkgs#355919