Skip to content

Commit

Permalink
test: use worker.exitedAfterDisconnect consistently
Browse files Browse the repository at this point in the history
PR-URL: #13702
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jasnell committed Jun 20, 2017
1 parent 3fab9f2 commit eaaec57
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 28 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-worker-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const cluster = require('cluster');
let worker;

worker = new cluster.Worker();
assert.strictEqual(worker.suicide, undefined);
assert.strictEqual(worker.exitedAfterDisconnect, undefined);
assert.strictEqual(worker.state, 'none');
assert.strictEqual(worker.id, 0);
assert.strictEqual(worker.process, undefined);
Expand All @@ -39,7 +39,7 @@ worker = new cluster.Worker({
state: 'online',
process: process
});
assert.strictEqual(worker.suicide, undefined);
assert.strictEqual(worker.exitedAfterDisconnect, undefined);
assert.strictEqual(worker.state, 'online');
assert.strictEqual(worker.id, 3);
assert.strictEqual(worker.process, process);
Expand Down
18 changes: 0 additions & 18 deletions test/parallel/test-cluster-worker-deprecated.js

This file was deleted.

4 changes: 0 additions & 4 deletions test/parallel/test-cluster-worker-disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ if (cluster.isWorker) {
http.Server(() => {

}).listen(0, '127.0.0.1');
const worker = cluster.worker;
assert.strictEqual(worker.exitedAfterDisconnect, worker.suicide);

cluster.worker.on('disconnect', common.mustCall(() => {
assert.strictEqual(cluster.worker.exitedAfterDisconnect,
cluster.worker.suicide);
process.exit(42);
}));

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-cluster-worker-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ if (cluster.isWorker) {
worker_emitDisconnect: [1, "the worker did not emit 'disconnect'"],
worker_emitExit: [1, "the worker did not emit 'exit'"],
worker_state: ['disconnected', 'the worker state is incorrect'],
worker_suicideMode: [false, 'the worker.suicide flag is incorrect'],
worker_exitedAfterDisconnect: [
false, 'the .exitedAfterDisconnect flag is incorrect'
],
Expand Down Expand Up @@ -84,7 +83,6 @@ if (cluster.isWorker) {
// Check worker events and properties
worker.on('disconnect', common.mustCall(() => {
results.worker_emitDisconnect += 1;
results.worker_suicideMode = worker.suicide;
results.worker_exitedAfterDisconnect = worker.exitedAfterDisconnect;
results.worker_state = worker.state;
if (results.worker_emitExit > 0) {
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-regress-GH-3238.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ if (cluster.isMaster) {
function forkWorker(action) {
const worker = cluster.fork({ action });
worker.on('disconnect', common.mustCall(() => {
assert.strictEqual(worker.suicide, true);
assert.strictEqual(worker.exitedAfterDisconnect, true);
}));

worker.on('exit', common.mustCall(() => {
assert.strictEqual(worker.suicide, true);
assert.strictEqual(worker.exitedAfterDisconnect, true);
}));
}

Expand Down

0 comments on commit eaaec57

Please sign in to comment.