test: running tls-server-verify clients in parallel
authorJoão Reis <reis@janeasystems.com>
Fri, 22 May 2015 13:16:07 +0000 (14:16 +0100)
committerAlexis Campailla <alexis@janeasystems.com>
Wed, 3 Jun 2015 17:11:17 +0000 (19:11 +0200)
OpenSSL s_client introduces some delay on Windows. With all clients
running sequentially, this delay is big enough to break CI. This fix runs
the clients in parallel (unless the test includes renegotiation),
reducing the total run time.

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 f30134f..2db47d3 100644 (file)
@@ -307,7 +307,21 @@ function runTest(testIndex) {
     if (tcase.debug) {
       console.error('TLS server running on port ' + common.PORT);
     } else {
-      runNextClient(0);
+      if (tcase.renegotiate) {
+        runNextClient(0);
+      } else {
+        var clientsCompleted = 0;
+        for (var i = 0; i < tcase.clients.length; i++) {
+          runClient(tcase.clients[i], function() {
+            clientsCompleted++;
+            if (clientsCompleted === tcase.clients.length) {
+              server.close();
+              successfulTests++;
+              runTest(testIndex + 1);
+            }
+          });
+        }
+      }
     }
   });
 }