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: https://github.com/nodejs/node/issues/8380 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
8361c26cd5
commit
2d2a2d7c78
@ -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));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user