test: kill child in tls-server-verify for speed up
authorShigeki Ohtsu <ohtsu@iij.ad.jp>
Wed, 27 May 2015 01:16:51 +0000 (10:16 +0900)
committerAlexis Campailla <alexis@janeasystems.com>
Wed, 3 Jun 2015 17:11:21 +0000 (19:11 +0200)
For better performance of the test, the parent kills child processes
so as not to wait them to be ended.

Fixes: https://github.com/nodejs/io.js/issues/1461
PR-URL: https://github.com/nodejs/io.js/pull/1836
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
test/parallel/test-tls-server-verify.js

index 556dc23..6ee8ac4 100644 (file)
@@ -195,7 +195,7 @@ function runClient(prefix, port, options, cb) {
     if (!goodbye && /_unauthed/g.test(out)) {
       console.error(prefix + '  * unauthed');
       goodbye = true;
-      client.stdin.end('goodbye\n');
+      client.kill();
       authed = false;
       rejected = false;
     }
@@ -203,7 +203,7 @@ function runClient(prefix, port, options, cb) {
     if (!goodbye && /_authed/g.test(out)) {
       console.error(prefix + '  * authed');
       goodbye = true;
-      client.stdin.end('goodbye\n');
+      client.kill();
       authed = true;
       rejected = false;
     }
@@ -265,6 +265,12 @@ function runTest(port, testIndex) {
 
   var renegotiated = false;
   var server = tls.Server(serverOptions, function handleConnection(c) {
+    c.on('error', function(e) {
+      // child.kill() leads ECONNRESET errro in the TLS connection of
+      // openssl s_client via spawn(). A Test result is already
+      // checked by the data of client.stdout before child.kill() so
+      // these tls errors can be ignored.
+    });
     if (tcase.renegotiate && !renegotiated) {
       renegotiated = true;
       setTimeout(function() {