test: fix test-dns-idna2008.js

The test should pass if ESERVFAIL is the result.

Refs: https://github.com/nodejs/node/issues/25870#issuecomment-471024667

PR-URL: https://github.com/nodejs/node/pull/27208
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Rich Trott 2019-04-12 20:54:53 -07:00
parent 82e6c3378f
commit f6bd3b27ee

View File

@ -43,11 +43,21 @@ dns.promises.lookup(fixture.hostname).then(({ address }) => {
}).finally(mustCall());
dns.resolve4(fixture.hostname, mustCall((err, addresses) => {
if (err && err.errno === 'ESERVFAIL') {
assert.ok(err.message.includes('queryA ESERVFAIL straße.de'));
return;
}
assert.ifError(err);
assert.deepStrictEqual(addresses, [fixture.expectedAddress]);
}));
const p = new dns.promises.Resolver().resolve4(fixture.hostname);
p.then(mustCall((addresses) => {
p.then((addresses) => {
assert.deepStrictEqual(addresses, [fixture.expectedAddress]);
}));
}, (err) => {
if (err && err.errno === 'ESERVFAIL') {
assert.ok(err.message.includes('queryA ESERVFAIL straße.de'));
} else {
throw err;
}
}).finally(mustCall());