GeezerVison is showing github.com — test: fix test-net-connect-reset-until-connected · nodejs/node@dfb566a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/parallel.status -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,8 +31,6 @@ test-crypto-dh-stateless: SKIP |
31 | 31 | test-crypto-keygen: SKIP |
32 | 32 |
|
33 | 33 | [$system==solaris] # Also applies to SmartOS |
34 | | -# https://github.com/nodejs/node/issues/43446 |
35 | | -test-net-connect-reset-until-connected: PASS, FLAKY |
36 | 34 | # https://github.com/nodejs/node/issues/43457 |
37 | 35 | test-domain-no-error-handler-abort-on-uncaught-0: PASS, FLAKY |
38 | 36 | test-domain-no-error-handler-abort-on-uncaught-1: PASS,FLAKY |
@@ -52,8 +50,6 @@ test-domain-with-abort-on-uncaught-exception: PASS, FLAKY |
52 | 50 | test-fs-stat-bigint: PASS,FLAKY |
53 | 51 | # https://github.com/nodejs/node/issues/31280 |
54 | 52 | test-worker-message-port-message-before-close: PASS,FLAKY |
55 | | -# https://github.com/nodejs/node/issues/43446 |
56 | | -test-net-connect-reset-until-connected: PASS, FLAKY |
57 | 53 |
|
58 | 54 | [$system==ibmi] |
59 | 55 | # https://github.com/nodejs/node/pull/30819 |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-net-connect-reset-until-connected.js +10-1Lines changed: 10 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
3 | 3 | const common = require('../common'); |
4 | 4 | const net = require('net'); |
5 | 5 |
|
| 6 | +function barrier(count, cb) { |
| 7 | + return function() { |
| 8 | + if (--count === 0) |
| 9 | + cb(); |
| 10 | + }; |
| 11 | +} |
| 12 | + |
6 | 13 | const server = net.createServer(); |
7 | 14 | server.listen(0, common.mustCall(function() { |
8 | 15 | const port = server.address().port; |
9 | 16 | const conn = net.createConnection(port); |
| 17 | + const connok = barrier(2, () => conn.resetAndDestroy()); |
10 | 18 | conn.on('close', common.mustCall()); |
11 | 19 | server.on('connection', (socket) => { |
| 20 | + connok(); |
12 | 21 | socket.on('error', common.expectsError({ |
13 | 22 | code: 'ECONNRESET', |
14 | 23 | message: 'read ECONNRESET', |
15 | 24 | name: 'Error' |
16 | 25 | })); |
17 | 26 | server.close(); |
18 | 27 | }); |
19 | | - conn.resetAndDestroy(); |
| 28 | + conn.on('connect', connok); |
20 | 29 | })); |