Skip to content

Commit

Permalink
test: prevent flakey test on pi2
Browse files Browse the repository at this point in the history
Looping rapidly and making new connections causes problems on pi2.
Instead create a new connection when an old connection has already been
made. Running a stress test of 600 times and they all passed.

Fixes: #5302
PR-URL: #5537
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Alexis Campailla <[email protected]>
  • Loading branch information
trevnorris committed Mar 3, 2016
1 parent 7d3a7ea commit 5d7265f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ prefix parallel
test-tick-processor : PASS,FLAKY

[$system==linux]
test-process-getactivehandles : PASS,FLAKY
test-tick-processor : PASS,FLAKY

[$system==macos]
Expand Down
17 changes: 10 additions & 7 deletions test/parallel/test-process-getactivehandles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ var clients_counter = 0;

const server = net.createServer(function listener(c) {
connections.push(c);
}).listen(common.PORT, function makeConnections() {
for (var i = 0; i < NUM; i++) {
net.connect(common.PORT, function connected() {
clientConnected(this);
});
}
});
}).listen(common.PORT, makeConnection);


function makeConnection() {
if (clients_counter >= NUM) return;
net.connect(common.PORT, function connected() {
clientConnected(this);
makeConnection();
});
}


function clientConnected(client) {
Expand Down

0 comments on commit 5d7265f

Please sign in to comment.