Skip to content

Commit 253c5aa

Browse files
vieiraarturgMylesBorins
authored andcommitted
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 <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent 1f97133 commit 253c5aa

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/parallel/test-net-reconnect-error.js renamed to test/sequential/test-net-reconnect-error.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ const N = 20;
66
let client_error_count = 0;
77
let disconnect_count = 0;
88

9-
// Hopefully nothing is running on common.PORT
109
const c = net.createConnection(common.PORT);
1110

1211
c.on('connect', function() {
1312
console.error('CLIENT connected');
1413
assert.ok(false);
1514
});
1615

17-
c.on('error', function(e) {
18-
console.error(`CLIENT error: ${e.code}`);
16+
c.on('error', common.mustCall((e) => {
1917
client_error_count++;
2018
assert.strictEqual('ECONNREFUSED', e.code);
21-
});
19+
}, N + 1));
2220

23-
c.on('close', function() {
24-
console.log('CLIENT disconnect');
21+
c.on('close', common.mustCall(() => {
2522
if (disconnect_count++ < N)
2623
c.connect(common.PORT); // reconnect
27-
});
24+
}, N + 1));
2825

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

0 commit comments

Comments
 (0)