Skip to content

Commit

Permalink
test: fix flaky test-cluster-shared-leak
Browse files Browse the repository at this point in the history
Wait for worker2 to come online before doing anything that might result
in an EPIPE. Fixes flakiness of test on Windows.

Fixes: #3956
PR-URL: #4510
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell<jasnell@gmail.com>
  • Loading branch information
Trott authored and Fishrock123 committed Jan 6, 2016
1 parent 1dd2d01 commit 984db93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 10 additions & 8 deletions test/parallel/test-cluster-shared-leak.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
});
}));

Expand Down

0 comments on commit 984db93

Please sign in to comment.