From ec24d3767b8db3c4099e8a529acacc99f0374f5c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 1 Jan 2016 13:26:23 -0800 Subject: [PATCH] test: fix flaky test-cluster-shared-leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wait for worker2 to come online before doing anything that might result in an EPIPE. Fixes flakiness of test on Windows. Fixes: https://github.com/nodejs/node/issues/3956 PR-URL: https://github.com/nodejs/node/pull/4510 Reviewed-By: Johan Bergström Reviewed-By: James M Snell --- test/parallel/parallel.status | 1 - test/parallel/test-cluster-shared-leak.js | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 02302b04acd676..482fd6f4597f2c 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -7,7 +7,6 @@ prefix parallel [true] # This section applies to all platforms [$system==win32] -test-cluster-shared-leak : PASS,FLAKY test-debug-no-context : PASS,FLAKY test-tls-ticket-cluster : PASS,FLAKY diff --git a/test/parallel/test-cluster-shared-leak.js b/test/parallel/test-cluster-shared-leak.js index a4de1d33a29b8d..55df57c9831ede 100644 --- a/test/parallel/test-cluster-shared-leak.js +++ b/test/parallel/test-cluster-shared-leak.js @@ -15,14 +15,16 @@ if (cluster.isMaster) { worker1 = cluster.fork(); worker1.on('message', common.mustCall(function() { worker2 = cluster.fork(); - conn = net.connect(common.PORT, common.mustCall(function() { - worker1.send('die'); - worker2.send('die'); - })); - conn.on('error', function(e) { - // ECONNRESET is OK - if (e.code !== 'ECONNRESET') - throw e; + worker2.on('online', function() { + conn = net.connect(common.PORT, common.mustCall(function() { + worker1.send('die'); + worker2.send('die'); + })); + conn.on('error', function(e) { + // ECONNRESET is OK + if (e.code !== 'ECONNRESET') + throw e; + }); }); }));