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>
This commit is contained in:
parent
5a2541de81
commit
063c9f6886
@ -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
|
||||
|
||||
|
@ -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;
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user