Skip to content

Commit a62ace9

Browse files
santigimenorvagg
authored andcommitted
test: fix tls-no-rsa-key flakiness
In some conditions it can happen that the client-side socket is destroyed before the server-side socket has gracefully closed, thus causing a 'ECONNRESET' error in this socket. To solve this, wait in the client-side socket for the 'end' event before closing it. PR-URL: #4043 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent ee01371 commit a62ace9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/parallel/test-tls-no-rsa-key.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ var server = tls.createServer(options, function(conn) {
2323
var c = tls.connect(common.PORT, {
2424
rejectUnauthorized: false
2525
}, function() {
26+
c.on('end', common.mustCall(function() {
27+
c.end();
28+
server.close();
29+
}));
30+
31+
c.on('data', function(data) {
32+
assert.equal(data, 'ok');
33+
});
34+
2635
cert = c.getPeerCertificate();
27-
c.destroy();
28-
server.close();
2936
});
3037
});
3138

0 commit comments

Comments
 (0)