Browse Source

test: fix cluster-worker-isdead

Check if the worker 'isDead' instead of 'isConnected' as the
'disconnect' event is not guaranteed to be received before the
'exit' event.
Remove the 'net' dependency as it is not used.

PR-URL: https://github.com/nodejs/node/pull/3954
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
process-exit-stdio-flushing
Santiago Gimeno 9 years ago
committed by minwoojung
parent
commit
f8cf9474ce
  1. 3
      test/parallel/test-cluster-worker-isdead.js

3
test/parallel/test-cluster-worker-isdead.js

@ -2,7 +2,6 @@
require('../common'); require('../common');
var cluster = require('cluster'); var cluster = require('cluster');
var assert = require('assert'); var assert = require('assert');
var net = require('net');
if (cluster.isMaster) { if (cluster.isMaster) {
var worker = cluster.fork(); var worker = cluster.fork();
@ -11,7 +10,7 @@ if (cluster.isMaster) {
'created.'); 'created.');
worker.on('exit', function() { worker.on('exit', function() {
assert.ok(!worker.isConnected(), assert.ok(worker.isDead(),
'After an event has been emitted, ' + 'After an event has been emitted, ' +
'isDead should return true'); 'isDead should return true');
}); });

Loading…
Cancel
Save