From a9492f503f742921477ebd682a94095fa957cdd4 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 26 May 2016 09:39:42 -0400 Subject: [PATCH] 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 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Santiago Gimeno --- test/parallel/test-cluster-disconnect-handles.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/parallel/test-cluster-disconnect-handles.js b/test/parallel/test-cluster-disconnect-handles.js index e2015254c5247b..e05733dbd9e953 100644 --- a/test/parallel/test-cluster-disconnect-handles.js +++ b/test/parallel/test-cluster-disconnect-handles.js @@ -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');