Skip to content

Commit 5b927b2

Browse files
Trottgibfahn
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 fadb297 commit 5b927b2

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
@@ -539,7 +539,7 @@ function _mustCallInner(fn, criteria = 1, field) {
539539
exports.hasMultiLocalhost = function hasMultiLocalhost() {
540540
const { TCP, constants: TCPConstants } = process.binding('tcp_wrap');
541541
const t = new TCP(TCPConstants.SOCKET);
542-
const ret = t.bind('127.0.0.2', exports.PORT);
542+
const ret = t.bind('127.0.0.2', 0);
543543
t.close();
544544
return ret === 0;
545545
};

0 commit comments

Comments
 (0)