Skip to content

Commit c60a7fa

Browse files
vieiraarturgrefack
authored andcommittedMay 20, 2017
test: move net reconnect error test to sequential
The usage of common.PORT could cause undesired port collisions when run in parallel. The following test was moved to sequential. test-net-reconnect-error.js PR-URL: #13033 Refs: #12376 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 06a617a commit c60a7fa

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed
 

‎test/parallel/test-net-reconnect-error.js ‎test/sequential/test-net-reconnect-error.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,19 @@ const N = 20;
2727
let client_error_count = 0;
2828
let disconnect_count = 0;
2929

30-
// Hopefully nothing is running on common.PORT
3130
const c = net.createConnection(common.PORT);
3231

3332
c.on('connect', common.mustNotCall('client should not have connected'));
3433

35-
c.on('error', function(e) {
36-
console.error(`CLIENT error: ${e.code}`);
34+
c.on('error', common.mustCall((e) => {
3735
client_error_count++;
3836
assert.strictEqual('ECONNREFUSED', e.code);
39-
});
37+
}, N + 1));
4038

41-
c.on('close', function() {
42-
console.log('CLIENT disconnect');
39+
c.on('close', common.mustCall(() => {
4340
if (disconnect_count++ < N)
4441
c.connect(common.PORT); // reconnect
45-
});
42+
}, N + 1));
4643

4744
process.on('exit', function() {
4845
assert.strictEqual(N + 1, disconnect_count);

0 commit comments

Comments
 (0)
Please sign in to comment.