aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-no-rsa-key.js
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2015-11-26 22:58:51 +0100
committerJames M Snell <jasnell@gmail.com>2016-02-02 09:19:11 -0800
commit61fe86b560a403d47e5a5a7fcd3be1f757878b37 (patch)
treebcdefb9a047545adaa8b473202d3bd2f6a6d15e6 /test/parallel/test-tls-no-rsa-key.js
parent0c924ea39f56e474c9056682a92fdb1fe4a27206 (diff)
downloadandroid-node-v8-61fe86b560a403d47e5a5a7fcd3be1f757878b37.tar.gz
android-node-v8-61fe86b560a403d47e5a5a7fcd3be1f757878b37.tar.bz2
android-node-v8-61fe86b560a403d47e5a5a7fcd3be1f757878b37.zip
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: https://github.com/nodejs/node/pull/4043 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-tls-no-rsa-key.js')
-rw-r--r--test/parallel/test-tls-no-rsa-key.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js
index 61e8a3b7ca..ff9806cdb0 100644
--- a/test/parallel/test-tls-no-rsa-key.js
+++ b/test/parallel/test-tls-no-rsa-key.js
@@ -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();
});
});