test: fix flaky cluster-disconnect-race
authorBrian White <mscdex@mscdex.net>
Mon, 28 Dec 2015 21:58:24 +0000 (16:58 -0500)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:38 +0000 (11:52 -0800)
On single core Windows systems, process.send() would cause an
EPIPE because of the ordering of the IPC channel disconnect and
the process.send().

The test was originally only relevant for non-Windows platforms,
so this commit merely skips the test on Windows.

Fixes: https://github.com/nodejs/node/issues/4450
PR-URL: https://github.com/nodejs/node/pull/4457
Reviewed-By: Rich Trott <rtrott@gmail.com>
test/parallel/test-cluster-disconnect-race.js

index 40cfd91..97d55a2 100644 (file)
@@ -7,6 +7,12 @@ const common = require('../common');
 const assert = require('assert');
 const net = require('net');
 const cluster = require('cluster');
+
+if (common.isWindows) {
+  console.log('1..0 # Skipped: This test does not apply to Windows.');
+  return;
+}
+
 cluster.schedulingPolicy = cluster.SCHED_NONE;
 
 if (cluster.isMaster) {
@@ -19,9 +25,9 @@ if (cluster.isMaster) {
     worker2.on('online', common.mustCall(worker2.disconnect));
   }));
 
-  cluster.on('exit', function(worker, code) {
+  cluster.on('exit', common.mustCall(function(worker, code) {
     assert.strictEqual(code, 0, 'worker exited with error');
-  });
+  }, 2));
 
   return;
 }