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 <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
cjihrig authored and rvagg committed Jun 2, 2016
1 parent ea287fc commit b5949f8
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 b5949f8

Please sign in to comment.