Skip to content

Commit

Permalink
test: verify cluster worker exit
Browse files Browse the repository at this point in the history
test-cluster-disconnect-handles already includes logic that
tries to cleanup any child processes when the test fails. This
commit adds additional checks to verify that the child exited
normally, and fails the test if that is not the case.

Refs: #6988
PR-URL: #6993
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
  • Loading branch information
cjihrig authored and Myles Borins committed Jul 12, 2016
1 parent 8c67aa6 commit b24cc8e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/parallel/test-cluster-disconnect-handles.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ if (cluster.isMaster) {
// scanner but is ignored by atoi(3). Heinous hack.
cluster.setupMaster({ execArgv: [`--debug=${common.PORT}.`] });
const worker = cluster.fork();
worker.once('exit', common.mustCall((code, signal) => {
assert.strictEqual(code, 0, 'worker did not exit normally');
assert.strictEqual(signal, null, 'worker did not exit normally');
}));
worker.on('message', common.mustCall((message) => {
assert.strictEqual(Array.isArray(message), true);
assert.strictEqual(message[0], 'listening');
Expand Down

0 comments on commit b24cc8e

Please sign in to comment.