Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix test-dns-idna2008 #33367

Merged
merged 1 commit into from May 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 25 additions & 19 deletions test/internet/test-dns-idna2008.js
Expand Up @@ -16,31 +16,37 @@ const { addresses } = require('../common/internet');
const fixture = {
hostname: 'stra脽e.de',
expectedAddress: '81.169.145.78',
dnsServer: addresses.DNS4_SERVER
dnsServer: addresses.DNS4_SERVER,
family: 4,
};

// Explicitly use well behaved DNS servers that are known to be able to resolve
// Explicitly use well-behaved DNS servers that are known to be able to resolve
// the query (which is a.k.a xn--strae-oqa.de).
dns.setServers([fixture.dnsServer]);

dns.lookup(fixture.hostname, mustCall((err, address) => {
if (err && err.errno === 'ESERVFAIL') {
assert.ok(err.message.includes('queryA ESERVFAIL stra脽e.de'));
return;
}
assert.ifError(err);
assert.strictEqual(address, fixture.expectedAddress);
}));
dns.lookup(
fixture.hostname,
{ family: fixture.family },
mustCall((err, address) => {
if (err && err.errno === 'ESERVFAIL') {
assert.ok(err.message.includes('queryA ESERVFAIL stra脽e.de'));
return;
}
assert.ifError(err);
assert.strictEqual(address, fixture.expectedAddress);
})
);

dns.promises.lookup(fixture.hostname).then(({ address }) => {
assert.strictEqual(address, fixture.expectedAddress);
}, (err) => {
if (err && err.errno === 'ESERVFAIL') {
assert.ok(err.message.includes('queryA ESERVFAIL stra脽e.de'));
} else {
throw err;
}
}).finally(mustCall());
dns.promises.lookup(fixture.hostname, { family: fixture.family })
.then(({ address }) => {
assert.strictEqual(address, fixture.expectedAddress);
}, (err) => {
if (err && err.errno === 'ESERVFAIL') {
assert.ok(err.message.includes('queryA ESERVFAIL stra脽e.de'));
} else {
throw err;
}
}).finally(mustCall());

dns.resolve4(fixture.hostname, mustCall((err, addresses) => {
if (err && err.errno === 'ESERVFAIL') {
Expand Down