From abd5d95711ee03265f3521712ef8a6794b5a6ecc Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 5 Dec 2017 00:31:20 -0800 Subject: [PATCH] test: remove hidden use of common.PORT in parallel tests common.hasMultiLocalhost() uses common.PORT under the hood. This is problematic in parallel tests because another test using port 0 to get an arbitrary open port may end up getting common.PORT before the test using common.PORT gets it. Therefore, change common.PORT to port 0 in common.hasMultiLocalhost(). PR-URL: https://github.com/nodejs/node/pull/17466 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Ruben Bridgewater --- test/common/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common/index.js b/test/common/index.js index db2458a40d26e4..1ed9952a514eeb 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -526,7 +526,7 @@ function _mustCallInner(fn, criteria = 1, field) { exports.hasMultiLocalhost = function hasMultiLocalhost() { const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const t = new TCP(TCPConstants.SOCKET); - const ret = t.bind('127.0.0.2', exports.PORT); + const ret = t.bind('127.0.0.2', 0); t.close(); return ret === 0; };