summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Reis <reis@janeasystems.com>2015-05-22 14:28:11 +0100
committerAlexis Campailla <alexis@janeasystems.com>2015-06-04 05:24:03 -0700
commit6d3450511b70fb1e05345b28a7cae039a7c02e99 (patch)
treedcc0ffdb37ba25616983e3b2d1e74f13893b681b
parent1191e651e4c0ee63db5730169a921341c90354d8 (diff)
downloadnode-6d3450511b70fb1e05345b28a7cae039a7c02e99.tar.gz
test: run tls-server-verify servers in parallel
Different servers must use different ports. Since we can count only on common.PORT and common.PORT+1, run only 2 servers in parallel. Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/joyent/node/pull/25368
-rw-r--r--test/simple/test-tls-server-verify.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/test/simple/test-tls-server-verify.js b/test/simple/test-tls-server-verify.js
index c8e969271..a42359678 100644
--- a/test/simple/test-tls-server-verify.js
+++ b/test/simple/test-tls-server-verify.js
@@ -141,14 +141,14 @@ var serverKey = loadPEM('agent2-key');
var serverCert = loadPEM('agent2-cert');
-function runClient(options, cb) {
+function runClient(port, options, cb) {
// Client can connect in three ways:
// - Self-signed cert
// - Certificate, but not signed by CA.
// - Certificate signed by CA.
- var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT];
+ var args = ['s_client', '-connect', '127.0.0.1:' + port];
console.log(' connecting with', options.name);
@@ -246,7 +246,7 @@ function runClient(options, cb) {
// Run the tests
var successfulTests = 0;
-function runTest(testIndex) {
+function runTest(port, testIndex) {
var tcase = testCases[testIndex];
if (!tcase) return;
@@ -309,31 +309,31 @@ function runTest(testIndex) {
function runNextClient(clientIndex) {
var options = tcase.clients[clientIndex];
if (options) {
- runClient(options, function() {
+ runClient(port, options, function() {
runNextClient(clientIndex + 1);
});
} else {
server.close();
successfulTests++;
- runTest(testIndex + 1);
+ runTest(port, nextTest++);
}
}
- server.listen(common.PORT, function() {
+ server.listen(port, function() {
if (tcase.debug) {
- console.error('TLS server running on port ' + common.PORT);
+ console.error('TLS server running on port ' + port);
} else {
if (tcase.renegotiate) {
runNextClient(0);
} else {
var clientsCompleted = 0;
for (var i = 0; i < tcase.clients.length; i++) {
- runClient(tcase.clients[i], function() {
+ runClient(port, tcase.clients[i], function() {
clientsCompleted++;
if (clientsCompleted === tcase.clients.length) {
server.close();
successfulTests++;
- runTest(testIndex + 1);
+ runTest(port, nextTest++);
}
});
}
@@ -343,7 +343,9 @@ function runTest(testIndex) {
}
-runTest(0);
+var nextTest = 0;
+runTest(common.PORT, nextTest++);
+runTest(common.PORT + 1, nextTest++);
process.on('exit', function() {