Skip to content
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: deflake test-cluster-shared-handle-bind-privileged-port #55378

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 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 @@ -21,6 +21,7 @@

'use strict';
const common = require('../common');
const { readFileSync } = require('fs');
RedYetiDev marked this conversation as resolved.
Show resolved Hide resolved

// Skip on macOS Mojave. https://github.com/nodejs/node/issues/21679
if (common.isMacOS)
Expand All @@ -35,6 +36,18 @@ if (common.isWindows)
if (process.getuid() === 0)
common.skip('as this test should not be run as `root`');

if (common.isLinux) {
RedYetiDev marked this conversation as resolved.
Show resolved Hide resolved
try {
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
if (unprivilegedPortStart <= 42) {
common.skip('Port 42 is unprivileged');
RedYetiDev marked this conversation as resolved.
Show resolved Hide resolved
}
} 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
Loading