Skip to content
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
17 changes: 8 additions & 9 deletions test/parallel/test-cluster-bind-twice.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ if (!id) {


a.on('message', common.mustCall((m) => {
if (typeof m === 'object') return;
assert.strictEqual(m, 'READY');
b.send('START');
assert.strictEqual(m.msg, 'READY');
b.send({msg: 'START', port: m.port});
}));

b.on('message', common.mustCall((m) => {
Expand All @@ -81,10 +80,10 @@ if (!id) {
} else if (id === 'one') {
if (cluster.isMaster) return startWorker();

http.createServer(common.mustNotCall())
.listen(common.PORT, common.mustCall(() => {
process.send('READY');
}));
const server = http.createServer(common.mustNotCall());
server.listen(0, common.mustCall(() => {
process.send({msg: 'READY', port: server.address().port});
}));

process.on('message', common.mustCall((m) => {
if (m === 'QUIT') process.exit();
Expand All @@ -95,8 +94,8 @@ if (!id) {
const server = http.createServer(common.mustNotCall());
process.on('message', common.mustCall((m) => {
if (m === 'QUIT') process.exit();
assert.strictEqual(m, 'START');
server.listen(common.PORT, common.mustNotCall());
assert.strictEqual(m.msg, 'START');
server.listen(m.port, common.mustNotCall());
server.on('error', common.mustCall((e) => {
assert.strictEqual(e.code, 'EADDRINUSE');
process.send(e.code);
Expand Down