diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2016-09-02 13:14:37 +0200 |
---|---|---|
committer | mhdawson <mhdawson@drx-hemera.ottawa.ibm.com> | 2016-09-02 14:54:47 -0400 |
commit | 2d2a2d7c780b71adec00096b7dd836714816ba54 (patch) | |
tree | f32d5108b00cb0023c12b5758762546fdc7da141 /test/parallel/test-cluster-dgram-1.js | |
parent | 8361c26cd5c1f0ac15437cf46f1bf2439e8d25b1 (diff) | |
download | android-node-v8-2d2a2d7c780b71adec00096b7dd836714816ba54.tar.gz android-node-v8-2d2a2d7c780b71adec00096b7dd836714816ba54.tar.bz2 android-node-v8-2d2a2d7c780b71adec00096b7dd836714816ba54.zip |
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>
Diffstat (limited to 'test/parallel/test-cluster-dgram-1.js')
-rw-r--r-- | test/parallel/test-cluster-dgram-1.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index 30420850a3..3b27fa8e20 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/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)); |