From a34cccceaa95aac034ff72420b70d7c7b055089d Mon Sep 17 00:00:00 2001 From: Sebastian Plesciuc Date: Mon, 17 Apr 2017 07:58:01 +0300 Subject: [PATCH] test: use dynamic port in 3 test-cluster-worker tests Remove common.PORT from test-cluster-worker-disconnect, test-cluster-worker-exit and test-cluster-worker-kill to eliminate the possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: https://github.com/nodejs/node/pull/12443 Ref: https://github.com/nodejs/node/issues/12376 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Gibson Fahnestock Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-cluster-worker-disconnect.js | 2 +- test/parallel/test-cluster-worker-exit.js | 2 +- test/parallel/test-cluster-worker-kill.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-cluster-worker-disconnect.js b/test/parallel/test-cluster-worker-disconnect.js index 684fd5541eac55..c2f7e611876d9d 100644 --- a/test/parallel/test-cluster-worker-disconnect.js +++ b/test/parallel/test-cluster-worker-disconnect.js @@ -7,7 +7,7 @@ if (cluster.isWorker) { const http = require('http'); http.Server(() => { - }).listen(common.PORT, '127.0.0.1'); + }).listen(0, '127.0.0.1'); const worker = cluster.worker; assert.strictEqual(worker.exitedAfterDisconnect, worker.suicide); diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js index 1cd7b1d0f222c7..8f1eceaf9e66ac 100644 --- a/test/parallel/test-cluster-worker-exit.js +++ b/test/parallel/test-cluster-worker-exit.js @@ -19,7 +19,7 @@ if (cluster.isWorker) { server.once('listening', common.mustCall(() => { process.exit(EXIT_CODE); })); - server.listen(common.PORT, '127.0.0.1'); + server.listen(0, '127.0.0.1'); } else if (cluster.isMaster) { diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index 834cd62bc06916..050f61ed47b4b7 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -15,7 +15,7 @@ if (cluster.isWorker) { const server = http.Server(() => { }); server.once('listening', common.mustCall(() => { })); - server.listen(common.PORT, '127.0.0.1'); + server.listen(0, '127.0.0.1'); } else if (cluster.isMaster) {