Skip to content

Commit 2d2a2d7

Browse files
santigimenomhdawson
authored and
mhdawson
committed
test: fix test-cluster-dgram-1 flakiness
Check for the number of messages received in the `exit` event listener instead of the `disconnect` listener. Fixes: #8380 PR-URL: #8383 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed By: James M Snell <[email protected]>
1 parent 8361c26 commit 2d2a2d7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/parallel/test-cluster-dgram-1.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ function master() {
6464

6565
worker.on('message', common.mustCall((msg) => {
6666
received = msg.received;
67+
worker.disconnect();
6768
}));
6869

69-
worker.on('disconnect', common.mustCall(() => {
70+
worker.on('exit', common.mustCall(() => {
7071
assert.strictEqual(received, PACKETS_PER_WORKER);
7172
}));
7273
}
@@ -85,7 +86,7 @@ function worker() {
8586
// Every 10 messages, notify the master.
8687
if (received === PACKETS_PER_WORKER) {
8788
process.send({received: received});
88-
process.disconnect();
89+
socket.close();
8990
}
9091
}, PACKETS_PER_WORKER));
9192

0 commit comments

Comments
 (0)