summaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-shared-leak.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-01-01 13:26:23 -0800
committerRich Trott <rtrott@gmail.com>2016-01-04 12:03:07 -0800
commit063c9f68865e1c5049fd4f29a547cad1b6fa7642 (patch)
tree7391f87eccd5e86506833a1e0a6d9e55bf44a2fb /test/parallel/test-cluster-shared-leak.js
parent5a2541de819e4457b05f4eca14d1926869b15be5 (diff)
downloadandroid-node-v8-063c9f68865e1c5049fd4f29a547cad1b6fa7642.tar.gz
android-node-v8-063c9f68865e1c5049fd4f29a547cad1b6fa7642.tar.bz2
android-node-v8-063c9f68865e1c5049fd4f29a547cad1b6fa7642.zip
test: fix flaky test-cluster-shared-leak
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 <bugs@bergstroem.nu> Reviewed-By: James M Snell<jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-cluster-shared-leak.js')
-rw-r--r--test/parallel/test-cluster-shared-leak.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/parallel/test-cluster-shared-leak.js b/test/parallel/test-cluster-shared-leak.js
index a4de1d33a2..55df57c983 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;
+ });
});
}));