Skip to content

Commit

Permalink
test: fix flaky cluster test on Windows 10
Browse files Browse the repository at this point in the history
test-cluster-shared-leak was flaky on Windows 10. Remove unnecessary
.send() calls and replace with .disconnect() to avoid spurious EPIPE.

Fixes: #4887
PR-URL: #4934
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and rvagg committed Feb 8, 2016
1 parent 3488fa8 commit 90219c3
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions test/parallel/test-cluster-shared-leak.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ if (cluster.isMaster) {
worker2 = cluster.fork();
worker2.on('online', function() {
conn = net.connect(common.PORT, common.mustCall(function() {
worker1.send('die');
worker2.send('die');
worker1.disconnect();
worker2.disconnect();
}));
conn.on('error', function(e) {
// ECONNRESET is OK
Expand All @@ -39,17 +39,10 @@ if (cluster.isMaster) {
return;
}

var server = net.createServer(function(c) {
const server = net.createServer(function(c) {
c.end('bye');
});

server.listen(common.PORT, function() {
process.send('listening');
});

process.on('message', function(msg) {
if (msg !== 'die') return;
server.close(function() {
setImmediate(() => process.disconnect());
});
});

0 comments on commit 90219c3

Please sign in to comment.