Skip to content

Commit 86a3ba0

Browse files
Sebastian Plesciucjasnell
Sebastian Plesciuc
authored andcommitted
test: dynamic port in cluster worker wait close
Remove common.PORT from test-cluster-worker-wait-server-close possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: #12466 Ref: #12376 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent 9c5c469 commit 86a3ba0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/parallel/test-cluster-worker-wait-server-close.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (cluster.isWorker) {
1212
// Wait for any data, then close connection
1313
socket.write('.');
1414
socket.on('data', common.noop);
15-
}).listen(common.PORT, common.localhostIPv4);
15+
}).listen(0, common.localhostIPv4);
1616

1717
server.once('close', function() {
1818
serverClosed = true;
@@ -33,8 +33,8 @@ if (cluster.isWorker) {
3333
const worker = cluster.fork();
3434

3535
// Disconnect worker when it is ready
36-
worker.once('listening', function() {
37-
const socket = net.createConnection(common.PORT, common.localhostIPv4);
36+
worker.once('listening', function(address) {
37+
const socket = net.createConnection(address.port, common.localhostIPv4);
3838

3939
socket.on('connect', function() {
4040
socket.on('data', function() {

0 commit comments

Comments
 (0)