0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

test: prevent flakey test on pi2

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: https://github.com/nodejs/node/issues/5302
PR-URL: https://github.com/nodejs/node/pull/5537
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
This commit is contained in:
Trevor Norris 2016-03-02 15:23:55 -07:00
parent 7d3a7ea0d7
commit 5d7265f601
2 changed files with 10 additions and 8 deletions

View File

@ -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]

View File

@ -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) {