Skip to content

Commit

Permalink
test: test for the exitedAfterDisconnect default value
Browse files Browse the repository at this point in the history
The test checka for the exit code of the worker. cluster on exit
must be called. And the value for exitedAfterDisconnect should be false

Fixes: nodejs#28837
Refs: nodejs#3743
  • Loading branch information
nimit95 committed Jul 26, 2019
1 parent 830e98a commit b2f60cb
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const common = require('../common');

// Test should fail in Node.js 5.4.1 and pass in later versions.

const assert = require('assert');
const cluster = require('cluster');

if (cluster.isMaster) {
cluster.on('exit', common.mustCall((worker, code) => {
assert.strictEqual(code, 0, `worker exited with code: ${code}, expected 0`);
assert.strictEqual(worker.exitedAfterDisconnect, false);
}));

return cluster.fork();
}

process.exit(0);

0 comments on commit b2f60cb

Please sign in to comment.