test: verify cluster worker exit
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: https://github.com/nodejs/node/issues/6988 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
6e2ae8aeee
commit
a9492f503f
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user