Skip to content

Commit

Permalink
test: fix tls-no-rsa-key flakiness
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
santigimeno authored and rvagg committed Feb 8, 2016
1 parent ee01371 commit a62ace9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/parallel/test-tls-no-rsa-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ var server = tls.createServer(options, function(conn) {
var c = tls.connect(common.PORT, {
rejectUnauthorized: false
}, function() {
c.on('end', common.mustCall(function() {
c.end();
server.close();
}));

c.on('data', function(data) {
assert.equal(data, 'ok');
});

cert = c.getPeerCertificate();
c.destroy();
server.close();
});
});

Expand Down

0 comments on commit a62ace9

Please sign in to comment.