From c17a37d95a5b5603c8d640245fda21e3c88b2bca Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Fri, 1 Feb 2019 11:12:19 -0800 Subject: [PATCH] test: wait for TCP connect, not TLS handshake Test assumed server gets a handshake before the client destroyed it, and didn't assert that dns.lookup() callback occurred. PR-URL: https://github.com/nodejs/node/pull/25508 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-tls-connect-address-family.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-tls-connect-address-family.js b/test/parallel/test-tls-connect-address-family.js index 569688ca8abd18..083208cc1d3ab0 100644 --- a/test/parallel/test-tls-connect-address-family.js +++ b/test/parallel/test-tls-connect-address-family.js @@ -15,7 +15,7 @@ function runTest() { tls.createServer({ cert: fixtures.readKey('agent1-cert.pem'), key: fixtures.readKey('agent1-key.pem'), - }, common.mustCall(function() { + }).on('connection', common.mustCall(function() { this.close(); })).listen(0, '::1', common.mustCall(function() { const options = { @@ -32,7 +32,9 @@ function runTest() { })); } -dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { +dns.lookup('localhost', { + family: 6, all: true +}, common.mustCall((err, addresses) => { if (err) { if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN') common.skip('localhost does not resolve to ::1'); @@ -44,4 +46,4 @@ dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { runTest(); else common.skip('localhost does not resolve to ::1'); -}); +}));