Skip to content

Commit

Permalink
test: fix test-cluster-worker-kill
Browse files Browse the repository at this point in the history
Don't check that the `disconnect` event is emitted before the `exit`
event as the order is not guaranteed.

PR-URL: #5814
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
santigimeno authored and Fishrock123 committed Mar 22, 2016
1 parent f0d885a commit d2fa644
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions test/parallel/test-cluster-worker-kill.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ...
Expand Down

0 comments on commit d2fa644

Please sign in to comment.