Skip to content

Commit

Permalink
test: remove common.PORT from multiple tests
Browse files Browse the repository at this point in the history
PR-URL: #12451
Ref: #12376
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
tarunbatra authored and gibfahn committed Jun 20, 2017
1 parent 6df6af1 commit d5491fc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-master-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (cluster.isWorker) {
const http = require('http');
http.Server(() => {

}).listen(common.PORT, '127.0.0.1');
}).listen(0, '127.0.0.1');

} else if (process.argv[2] === 'cluster') {

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-master-kill.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (cluster.isWorker) {

// keep the worker alive
const http = require('http');
http.Server().listen(common.PORT, '127.0.0.1');
http.Server().listen(0, '127.0.0.1');

} else if (process.argv[2] === 'cluster') {

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-net-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ if (process.argv[2] !== 'child') {
socketConnected();
});

server.listen(common.PORT, function() {
socket = net.connect(common.PORT, '127.0.0.1', socketConnected);
server.listen(0, function() {
socket = net.connect(server.address().port, '127.0.0.1', socketConnected);
});

process.on('disconnect', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-rr-domain-listen.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const cluster = require('cluster');
const domain = require('domain');

Expand All @@ -11,7 +11,7 @@ if (cluster.isWorker) {
d.run(function() { });

const http = require('http');
http.Server(function() { }).listen(common.PORT, '127.0.0.1');
http.Server(function() { }).listen(0, '127.0.0.1');

} else if (cluster.isMaster) {
let worker;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-rr-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (cluster.isMaster) {
});
} else {
const server = net.createServer(common.mustNotCall());
server.listen(common.PORT, function() {
server.listen(0, function() {
server.unref();
server.ref();
server.close(function() {
Expand Down
8 changes: 3 additions & 5 deletions test/parallel/test-cluster-shared-leak.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ if (cluster.isMaster) {
let conn, worker2;

const worker1 = cluster.fork();
worker1.on('message', common.mustCall(function() {
worker1.on('listening', common.mustCall(function(address) {
worker2 = cluster.fork();
worker2.on('online', function() {
conn = net.connect(common.PORT, common.mustCall(function() {
conn = net.connect(address.port, common.mustCall(function() {
worker1.disconnect();
worker2.disconnect();
}));
Expand Down Expand Up @@ -48,6 +48,4 @@ const server = net.createServer(function(c) {
c.end('bye');
});

server.listen(common.PORT, function() {
process.send('listening');
});
server.listen(0);
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-worker-no-exit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const cluster = require('cluster');
const net = require('net');
Expand Down Expand Up @@ -34,7 +34,7 @@ if (cluster.isMaster) {
success = true;
});

}).listen(common.PORT, function() {
}).listen(0, function() {
const port = this.address().port;

worker = cluster.fork()
Expand Down

0 comments on commit d5491fc

Please sign in to comment.