Skip to content

Commit fe9d9f7

Browse files
TrottMylesBorins
authored andcommitted
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: #17466 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent f7b0054 commit fe9d9f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/common/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ function _mustCallInner(fn, criteria = 1, field) {
526526
exports.hasMultiLocalhost = function hasMultiLocalhost() {
527527
const { TCP, constants: TCPConstants } = process.binding('tcp_wrap');
528528
const t = new TCP(TCPConstants.SOCKET);
529-
const ret = t.bind('127.0.0.2', exports.PORT);
529+
const ret = t.bind('127.0.0.2', 0);
530530
t.close();
531531
return ret === 0;
532532
};

0 commit comments

Comments
 (0)