From 8d394810e851efe24b4c880b9fa39d8e07cf661a Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Sun, 20 Mar 2016 21:11:36 +0100 Subject: [PATCH] test: fix `test-cluster-worker-kill` Don't check that the `disconnect` event is emitted before the `exit` event as the order is not guaranteed. PR-URL: https://github.com/nodejs/node/pull/5814 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-cluster-worker-kill.js | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index 1ad9433f1ac940..1f44c93488b1e6 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -60,8 +60,6 @@ if (cluster.isWorker) { results.cluster_exitCode = worker.process.exitCode; results.cluster_signalCode = worker.process.signalCode; results.cluster_emitExit += 1; - assert.ok(results.cluster_emitDisconnect, - "cluster: 'exit' event before 'disconnect' event"); }); // Check worker events and properties @@ -77,26 +75,11 @@ if (cluster.isWorker) { results.worker_signalCode = signalCode; results.worker_emitExit += 1; results.worker_died = !alive(worker.process.pid); - assert.ok(results.worker_emitDisconnect, - "worker: 'exit' event before 'disconnect' event"); - - process.nextTick(function() { finish_test(); }); }); - var finish_test = function() { - try { - checkResults(expected_results, results); - } catch (exc) { - console.error('FAIL: ' + exc.message); - if (exc.name != 'AssertionError') { - console.trace(exc); - } - - process.exit(1); - return; - } - process.exit(0); - }; + process.on('exit', function() { + checkResults(expected_results, results); + }); } // some helper functions ...