Skip to content

Commit c10c671

Browse files
avivkelleraduh95
authored andcommitted
test: deflake test-cluster-shared-handle-bind-privileged-port
PR-URL: #55378 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent bfc10a9 commit c10c671

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/parallel/test-cluster-shared-handle-bind-privileged-port.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ if (common.isWindows)
3535
if (process.getuid() === 0)
3636
common.skip('as this test should not be run as `root`');
3737

38+
// Some systems won't have port 42 set as a privileged port, in that
39+
// case, skip the test.
40+
if (common.isLinux) {
41+
const { readFileSync } = require('fs');
42+
43+
try {
44+
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
45+
if (unprivilegedPortStart <= 42) {
46+
common.skip('Port 42 is unprivileged');
47+
}
48+
} catch {
49+
// Do nothing, feature doesn't exist, minimum is 1024 so 42 is usable.
50+
// Continue...
51+
}
52+
}
53+
3854
const assert = require('assert');
3955
const cluster = require('cluster');
4056
const net = require('net');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy