From 6b7431e3baa50b4323a286f5bc18c2b86f05fdd8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 22 Jan 2019 19:27:14 -0800 Subject: [PATCH] test: remove common.isOSXMojave common.isOSXMojave was added because it was believed that there was a bug in macOS Mojave that allowed unprivileged users to bind to privileged ports. As it turns out, that was a feature not a bug. It is likely to be in all future versions of macOS. Remove isOSXMojave and skip appropriate tests based on isOSX. --- test/common/index.js | 3 --- .../test-cluster-bind-privileged-port.js | 25 ------------------- .../test-cluster-bind-privileged-port.js | 4 +-- ...ster-shared-handle-bind-privileged-port.js | 4 +-- 4 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 test/known_issues/test-cluster-bind-privileged-port.js diff --git a/test/common/index.js b/test/common/index.js index eb9d511cb3cf97..eeaa5737dbaade 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -99,8 +99,6 @@ const isOpenBSD = process.platform === 'openbsd'; const isLinux = process.platform === 'linux'; const isOSX = process.platform === 'darwin'; -const isOSXMojave = isOSX && (os.release().startsWith('18')); - const enoughTestMem = os.totalmem() > 0x70000000; /* 1.75 Gb */ const cpus = os.cpus(); const enoughTestCpu = Array.isArray(cpus) && @@ -739,7 +737,6 @@ module.exports = { isMainThread, isOpenBSD, isOSX, - isOSXMojave, isSunOS, isWindows, localIPv6Hosts, diff --git a/test/known_issues/test-cluster-bind-privileged-port.js b/test/known_issues/test-cluster-bind-privileged-port.js deleted file mode 100644 index 6ada04aa030b31..00000000000000 --- a/test/known_issues/test-cluster-bind-privileged-port.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; -const common = require('../common'); - -// This test should fail on macOS (10.14) due to an issue with privileged ports. - -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (!common.isOSXMojave) - assert.fail('Code should fail only on macOS Mojave.'); - - -if (cluster.isMaster) { - cluster.fork().on('exit', common.mustCall((exitCode) => { - assert.strictEqual(exitCode, 0); - })); -} else { - const s = net.createServer(common.mustNotCall()); - s.listen(42, common.mustNotCall('listen should have failed')); - s.on('error', common.mustCall((err) => { - assert.strictEqual(err.code, 'EACCES'); - process.disconnect(); - })); -} diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index 9d155259c3789e..e95768a8fcc2b4 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -23,8 +23,8 @@ const common = require('../common'); // Skip on OS X Mojave. https://github.com/nodejs/node/issues/21679 -if (common.isOSXMojave) - common.skip('bypass test for Mojave due to OSX issue'); +if (common.isOSX) + common.skip('macOS may allow ordinary processes to use any port'); if (common.isWindows) common.skip('not reliable on Windows.'); diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 1edece30af6de9..d8fae065fa15ff 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -23,8 +23,8 @@ const common = require('../common'); // Skip on OS X Mojave. https://github.com/nodejs/node/issues/21679 -if (common.isOSXMojave) - common.skip('bypass test for Mojave due to OSX issue'); +if (common.isOSX) + common.skip('macOS may allow ordinary processes to use any port'); if (common.isWindows) common.skip('not reliable on Windows');