From d8f5f55b784dd9d5c96f4d5f866a9917d8a78f43 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Mon, 25 Feb 2019 09:35:09 -0500 Subject: [PATCH] test: eliminate port collision In test test-cluster-net-listen-ipv6only-rr, the cluster member that listens to `any` port actually has the potential to `grab` any port from the environment which when passed onto the master causes collision when it tries to listen on. Moving the test to sequential alone is not sufficient as the cluster member can in theory catch on to the admin ports on the host. Assigning static port alone is also not sufficient, as it can interfere with other running tests in the parallel category which would be mostly running with `port: any` fashion. So move to sequential, and use a static port. Fixes: https://github.com/nodejs/node/issues/25813 PR-URL: https://github.com/nodejs/node/pull/26298 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Beth Griggs --- .../test-cluster-net-listen-ipv6only-rr.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename test/{parallel => sequential}/test-cluster-net-listen-ipv6only-rr.js (80%) diff --git a/test/parallel/test-cluster-net-listen-ipv6only-rr.js b/test/sequential/test-cluster-net-listen-ipv6only-rr.js similarity index 80% rename from test/parallel/test-cluster-net-listen-ipv6only-rr.js rename to test/sequential/test-cluster-net-listen-ipv6only-rr.js index e5944ccf602e54..a42be88ddf17f0 100644 --- a/test/parallel/test-cluster-net-listen-ipv6only-rr.js +++ b/test/sequential/test-cluster-net-listen-ipv6only-rr.js @@ -48,9 +48,14 @@ if (cluster.isMaster) { workers.set(i, worker); } } else { + // As the cluster member has the potential to grab any port + // from the environment, this can cause collision when master + // obtains the port from cluster member and tries to listen on. + // So move this to sequential, and provide a static port. + // Refs: https://github.com/nodejs/node/issues/25813 net.createServer().listen({ - host, - port: 0, + host: host, + port: common.PORT, ipv6Only: true, }, common.mustCall()); }