Skip to content

Commit

Permalink
test: wait for TCP connect, not TLS handshake
Browse files Browse the repository at this point in the history
Test assumed server gets a handshake before the client destroyed it, and
didn't assert that dns.lookup() callback occurred.

PR-URL: #25508
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
sam-github committed Feb 6, 2019
1 parent 5d52c8e commit cdd6eb2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/parallel/test-tls-connect-address-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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');
Expand All @@ -44,4 +46,4 @@ dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => {
runTest();
else
common.skip('localhost does not resolve to ::1');
});
}));

0 comments on commit cdd6eb2

Please sign in to comment.