test: end tls gracefully, rather than destroy

The timing of destroy between client/server is undefined, but end is
guaranteed to occur.

PR-URL: https://github.com/nodejs/node/pull/25508
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Sam Roberts 2019-02-01 12:00:01 -08:00
parent bca2e219a3
commit 1bd42833d7
2 changed files with 2 additions and 2 deletions

View File

@ -115,6 +115,7 @@ let clientError;
const server = tls.createServer(serverOptions, function(c) {
serverResults.push({ sni: c.servername, authorized: c.authorized });
c.end();
});
server.on('tlsClientError', function(err) {
@ -135,7 +136,6 @@ function startTest() {
clientResults.push(
client.authorizationError &&
(client.authorizationError === 'ERR_TLS_CERT_ALTNAME_INVALID'));
client.destroy();
next();
});

View File

@ -86,6 +86,7 @@ const clientResults = [];
const server = tls.createServer(serverOptions, function(c) {
serverResults.push(c.servername);
c.end();
});
server.addContext('a.example.com', SNIContexts['a.example.com']);
@ -107,7 +108,6 @@ function startTest() {
clientResults.push(
client.authorizationError &&
(client.authorizationError === 'ERR_TLS_CERT_ALTNAME_INVALID'));
client.destroy();
// Continue
start();