mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
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: https://github.com/nodejs/node/pull/12466 Ref: https://github.com/nodejs/node/issues/12376 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
1 parent
0383048b76
commit
8a59f6b038
1 file changed
+3
-3
@@ -12,7 +12,7 @@ if (cluster.isWorker) {
|
||||
// Wait for any data, then close connection
|
||||
socket.write('.');
|
||||
socket.on('data', function discard() {});
|
||||
}).listen(common.PORT, common.localhostIPv4);
|
||||
}).listen(0, common.localhostIPv4);
|
||||
|
||||
server.once('close', function() {
|
||||
serverClosed = true;
|
||||
@@ -33,8 +33,8 @@ if (cluster.isWorker) {
|
||||
const worker = cluster.fork();
|
||||
|
||||
// Disconnect worker when it is ready
|
||||
worker.once('listening', function() {
|
||||
const socket = net.createConnection(common.PORT, common.localhostIPv4);
|
||||
worker.once('listening', function(address) {
|
||||
const socket = net.createConnection(address.port, common.localhostIPv4);
|
||||
|
||||
socket.on('connect', function() {
|
||||
socket.on('data', function() {
|
||||
|
||||
Reference in new issue
Block a user