Permalink
Browse files

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 <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
santigimeno authored and Fishrock123 committed Sep 2, 2016
1 parent 6d421a2 commit f0300eda27aabac8c5d4033c79939fcc7e4c0edc
Showing with 3 additions and 2 deletions.
  1. +3 −2 test/parallel/test-cluster-dgram-1.js
@@ -64,9 +64,10 @@ function master() {
worker.on('message', common.mustCall((msg) => {
received = msg.received;
worker.disconnect();
}));
worker.on('disconnect', common.mustCall(() => {
worker.on('exit', common.mustCall(() => {
assert.strictEqual(received, PACKETS_PER_WORKER);
}));
}
@@ -85,7 +86,7 @@ function worker() {
// Every 10 messages, notify the master.
if (received === PACKETS_PER_WORKER) {
process.send({received: received});
process.disconnect();
socket.close();
}
}, PACKETS_PER_WORKER));

0 comments on commit f0300ed

Please sign in to comment.