Skip to content

Commit 8c412af

Browse files
cjihrigMyles Borins
authored and
Myles Borins
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent f395f6f commit 8c412af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

+4
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)