11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst dns = require('dns'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst localhost = [ '127.0.0.1' ]; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci{ 111cb0ef41Sopenharmony_ci // Fix https://github.com/nodejs/node/issues/14734 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci { 141cb0ef41Sopenharmony_ci const resolver = new dns.Resolver(); 151cb0ef41Sopenharmony_ci resolver.resolve('localhost', common.mustCall()); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci assert.throws(resolver.setServers.bind(resolver, localhost), { 181cb0ef41Sopenharmony_ci code: 'ERR_DNS_SET_SERVERS_FAILED', 191cb0ef41Sopenharmony_ci message: /^c-ares failed to set servers: "There are pending queries\." \[.+\]$/g 201cb0ef41Sopenharmony_ci }); 211cb0ef41Sopenharmony_ci } 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci { 241cb0ef41Sopenharmony_ci dns.resolve('localhost', common.mustCall()); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci // should not throw 271cb0ef41Sopenharmony_ci dns.setServers(localhost); 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci} 30