Skip to content

Commit ec24d37

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
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: #3956 PR-URL: #4510 Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: James M Snell<[email protected]>
1 parent b8213ba commit ec24d37

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

test/parallel/parallel.status

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ prefix parallel
77
[true] # This section applies to all platforms
88

99
[$system==win32]
10-
test-cluster-shared-leak : PASS,FLAKY
1110
test-debug-no-context : PASS,FLAKY
1211
test-tls-ticket-cluster : PASS,FLAKY
1312

test/parallel/test-cluster-shared-leak.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ if (cluster.isMaster) {
1515
worker1 = cluster.fork();
1616
worker1.on('message', common.mustCall(function() {
1717
worker2 = cluster.fork();
18-
conn = net.connect(common.PORT, common.mustCall(function() {
19-
worker1.send('die');
20-
worker2.send('die');
21-
}));
22-
conn.on('error', function(e) {
23-
// ECONNRESET is OK
24-
if (e.code !== 'ECONNRESET')
25-
throw e;
18+
worker2.on('online', function() {
19+
conn = net.connect(common.PORT, common.mustCall(function() {
20+
worker1.send('die');
21+
worker2.send('die');
22+
}));
23+
conn.on('error', function(e) {
24+
// ECONNRESET is OK
25+
if (e.code !== 'ECONNRESET')
26+
throw e;
27+
});
2628
});
2729
}));
2830

0 commit comments

Comments
 (0)