mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 13:47:16 +00:00

Replace Google DNS servers with 127.0.0.1 in test-dns-setserver-when-querying. Refs: https://github.com/nodejs/node/issues/25664 PR-URL: https://github.com/nodejs/node/pull/25694 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
29 lines
604 B
JavaScript
29 lines
604 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const dns = require('dns');
|
|
|
|
const localhost = [ '127.0.0.1' ];
|
|
|
|
{
|
|
// Fix https://github.com/nodejs/node/issues/14734
|
|
|
|
{
|
|
const resolver = new dns.Resolver();
|
|
resolver.resolve('localhost', common.mustCall());
|
|
|
|
common.expectsError(resolver.setServers.bind(resolver, localhost), {
|
|
code: 'ERR_DNS_SET_SERVERS_FAILED',
|
|
message: /^c-ares failed to set servers: "There are pending queries\." \[.+\]$/g
|
|
});
|
|
}
|
|
|
|
{
|
|
dns.resolve('localhost', common.mustCall());
|
|
|
|
// should not throw
|
|
dns.setServers(localhost);
|
|
}
|
|
}
|