Skip to content

Commit

Permalink
test: remove hidden use of common.PORT in parallel tests
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and MylesBorins committed Dec 12, 2017
1 parent f7b0054 commit fe9d9f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit fe9d9f7

Please sign in to comment.