mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
ea287fc1a6
commit
b5949f8bbc
1 file changed
+4
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user