Skip to content

Commit

Permalink
test: covering destroying when worker already disconnected
Browse files Browse the repository at this point in the history
This test covers 374 line in lib/internal/cluster/master
that was uncovered by previous tests

PR-URL: #27896
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Keroosha authored and targos committed Jun 2, 2019
1 parent c683cd9 commit 9229825
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/parallel/test-cluster-call-and-destroy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';
const common = require('../common');
const cluster = require('cluster');
const assert = require('assert');

if (cluster.isMaster) {
const worker = cluster.fork();
worker.on('disconnect', common.mustCall(() => {
assert.strictEqual(worker.isConnected(), false);
worker.destroy();
}));
} else {
assert.strictEqual(cluster.worker.isConnected(), true);
cluster.worker.disconnect();
}

0 comments on commit 9229825

Please sign in to comment.