Skip to content

Commit a28376b

Browse files
Aviv Kellermarco-ippolito
Aviv Keller
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 c623657 commit a28376b

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

+16
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)