Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use dynamic port in test-cluster-dgram-reuse #12426

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions test/parallel/test-cluster-dgram-reuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,13 @@ function close() {
cluster.worker.disconnect();
}

for (let i = 0; i < 2; i++)
dgram.createSocket({ type: 'udp4', reuseAddr: true }).bind(common.PORT, next);
// Creates the first socket
const socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
// Let the OS assign a random port to the first socket
socket.bind(0, common.mustCall(function() {
// Creates the second socket using the same port from the previous one
dgram.createSocket({ type: 'udp4', reuseAddr: true })
.bind(socket.address().port, next);
// Call next for the first socket
next.call(this);
}));