Skip to content

Commit

Permalink
test: deflake test-cluster-shared-handle-bind-privileged-port
Browse files Browse the repository at this point in the history
PR-URL: #55378
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
RedYetiDev authored Oct 22, 2024
1 parent b76bcb3 commit d3526af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/parallel/test-cluster-shared-handle-bind-privileged-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ if (common.isWindows)
if (process.getuid() === 0)
common.skip('as this test should not be run as `root`');

// Some systems won't have port 42 set as a privileged port, in that
// case, skip the test.
if (common.isLinux) {
const { readFileSync } = require('fs');

try {
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
if (unprivilegedPortStart <= 42) {
common.skip('Port 42 is unprivileged');
}
} catch {
// Do nothing, feature doesn't exist, minimum is 1024 so 42 is usable.
// Continue...
}
}

const assert = require('assert');
const cluster = require('cluster');
const net = require('net');
Expand Down

0 comments on commit d3526af

Please sign in to comment.