11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst { internalBinding } = require('internal/test/binding'); 61cb0ef41Sopenharmony_ciconst cares = internalBinding('cares_wrap'); 71cb0ef41Sopenharmony_ciconst { UV_EPERM } = internalBinding('uv'); 81cb0ef41Sopenharmony_ciconst dnsPromises = require('dns').promises; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci// Stub cares to force an error so we can test DNS error code path. 111cb0ef41Sopenharmony_cicares.ChannelWrap.prototype.queryA = () => UV_EPERM; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciassert.rejects( 141cb0ef41Sopenharmony_ci dnsPromises.resolve('example.org'), 151cb0ef41Sopenharmony_ci { 161cb0ef41Sopenharmony_ci code: 'EPERM', 171cb0ef41Sopenharmony_ci syscall: 'queryA', 181cb0ef41Sopenharmony_ci hostname: 'example.org' 191cb0ef41Sopenharmony_ci } 201cb0ef41Sopenharmony_ci); 21