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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Sam Roberts 2019-02-01 11:12:19 -08:00
parent 5d52c8e43c
commit cdd6eb237b

View File

@ -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');
});
}));