Skip to content

Commit a9492f5

Browse files
committed
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: #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>
1 parent 6e2ae8a commit a9492f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/parallel/test-cluster-disconnect-handles.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ if (cluster.isMaster) {
3131
// scanner but is ignored by atoi(3). Heinous hack.
3232
cluster.setupMaster({ execArgv: [`--debug=${common.PORT}.`] });
3333
const worker = cluster.fork();
34+
worker.once('exit', common.mustCall((code, signal) => {
35+
assert.strictEqual(code, 0, 'worker did not exit normally');
36+
assert.strictEqual(signal, null, 'worker did not exit normally');
37+
}));
3438
worker.on('message', common.mustCall((message) => {
3539
assert.strictEqual(Array.isArray(message), true);
3640
assert.strictEqual(message[0], 'listening');

0 commit comments

Comments
 (0)