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. 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>
This commit is contained in:
parent
b18604ba2c
commit
975e5956f0
@ -125,14 +125,14 @@ var serverKey = loadPEM('agent2-key');
|
|||||||
var serverCert = loadPEM('agent2-cert');
|
var serverCert = loadPEM('agent2-cert');
|
||||||
|
|
||||||
|
|
||||||
function runClient(options, cb) {
|
function runClient(port, options, cb) {
|
||||||
|
|
||||||
// Client can connect in three ways:
|
// Client can connect in three ways:
|
||||||
// - Self-signed cert
|
// - Self-signed cert
|
||||||
// - Certificate, but not signed by CA.
|
// - Certificate, but not signed by CA.
|
||||||
// - Certificate 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);
|
console.log(' connecting with', options.name);
|
||||||
@ -230,7 +230,7 @@ function runClient(options, cb) {
|
|||||||
|
|
||||||
// Run the tests
|
// Run the tests
|
||||||
var successfulTests = 0;
|
var successfulTests = 0;
|
||||||
function runTest(testIndex) {
|
function runTest(port, testIndex) {
|
||||||
var tcase = testCases[testIndex];
|
var tcase = testCases[testIndex];
|
||||||
if (!tcase) return;
|
if (!tcase) return;
|
||||||
|
|
||||||
@ -293,31 +293,31 @@ function runTest(testIndex) {
|
|||||||
function runNextClient(clientIndex) {
|
function runNextClient(clientIndex) {
|
||||||
var options = tcase.clients[clientIndex];
|
var options = tcase.clients[clientIndex];
|
||||||
if (options) {
|
if (options) {
|
||||||
runClient(options, function() {
|
runClient(port, options, function() {
|
||||||
runNextClient(clientIndex + 1);
|
runNextClient(clientIndex + 1);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
server.close();
|
server.close();
|
||||||
successfulTests++;
|
successfulTests++;
|
||||||
runTest(testIndex + 1);
|
runTest(port, nextTest++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server.listen(common.PORT, function() {
|
server.listen(port, function() {
|
||||||
if (tcase.debug) {
|
if (tcase.debug) {
|
||||||
console.error('TLS server running on port ' + common.PORT);
|
console.error('TLS server running on port ' + port);
|
||||||
} else {
|
} else {
|
||||||
if (tcase.renegotiate) {
|
if (tcase.renegotiate) {
|
||||||
runNextClient(0);
|
runNextClient(0);
|
||||||
} else {
|
} else {
|
||||||
var clientsCompleted = 0;
|
var clientsCompleted = 0;
|
||||||
for (var i = 0; i < tcase.clients.length; i++) {
|
for (var i = 0; i < tcase.clients.length; i++) {
|
||||||
runClient(tcase.clients[i], function() {
|
runClient(port, tcase.clients[i], function() {
|
||||||
clientsCompleted++;
|
clientsCompleted++;
|
||||||
if (clientsCompleted === tcase.clients.length) {
|
if (clientsCompleted === tcase.clients.length) {
|
||||||
server.close();
|
server.close();
|
||||||
successfulTests++;
|
successfulTests++;
|
||||||
runTest(testIndex + 1);
|
runTest(port, nextTest++);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -327,7 +327,9 @@ function runTest(testIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
runTest(0);
|
var nextTest = 0;
|
||||||
|
runTest(common.PORT, nextTest++);
|
||||||
|
runTest(common.PORT + 1, nextTest++);
|
||||||
|
|
||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user