Browse Source

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 <benjamingr@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Sebastian Plesciuc 8 years ago
committed by Myles Borins
parent
commit
384fa17ffa
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 2
      test/parallel/test-cluster-worker-disconnect.js
  2. 2
      test/parallel/test-cluster-worker-exit.js
  3. 2
      test/parallel/test-cluster-worker-kill.js

2
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);

2
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) {

2
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) {

Loading…
Cancel
Save