diff options
author | cjihrig <cjihrig@gmail.com> | 2018-06-11 14:56:33 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-06-20 13:35:27 -0400 |
commit | 7486c4d71060e2ae3e754cf01e8fb02696eacd13 (patch) | |
tree | 8b48c47271d474800f1222f729e93f477f3fd395 /test/parallel/test-dns-resolveany-bad-ancount.js | |
parent | fea3595c2f92beb0d31feb93da1c972cc30e6fec (diff) | |
download | android-node-v8-7486c4d71060e2ae3e754cf01e8fb02696eacd13.tar.gz android-node-v8-7486c4d71060e2ae3e754cf01e8fb02696eacd13.tar.bz2 android-node-v8-7486c4d71060e2ae3e754cf01e8fb02696eacd13.zip |
dns: add promisified dns module
PR-URL: https://github.com/nodejs/node/pull/21264
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'test/parallel/test-dns-resolveany-bad-ancount.js')
-rw-r--r-- | test/parallel/test-dns-resolveany-bad-ancount.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/parallel/test-dns-resolveany-bad-ancount.js b/test/parallel/test-dns-resolveany-bad-ancount.js index 63ed1774b1..d48d9385b8 100644 --- a/test/parallel/test-dns-resolveany-bad-ancount.js +++ b/test/parallel/test-dns-resolveany-bad-ancount.js @@ -4,6 +4,9 @@ const dnstools = require('../common/dns'); const dns = require('dns'); const assert = require('assert'); const dgram = require('dgram'); +const dnsPromises = dns.promises; + +common.crashOnUnhandledRejection(); const server = dgram.createSocket('udp4'); @@ -20,12 +23,20 @@ server.on('message', common.mustCall((msg, { address, port }) => { // Overwrite the # of answers with 2, which is incorrect. buf.writeUInt16LE(2, 6); server.send(buf, port, address); -})); +}, 2)); -server.bind(0, common.mustCall(() => { +server.bind(0, common.mustCall(async () => { const address = server.address(); dns.setServers([`127.0.0.1:${address.port}`]); + dnsPromises.resolveAny('example.org') + .then(common.mustNotCall()) + .catch(common.expectsError({ + code: 'EBADRESP', + syscall: 'queryAny', + hostname: 'example.org' + })); + dns.resolveAny('example.org', common.mustCall((err) => { assert.strictEqual(err.code, 'EBADRESP'); assert.strictEqual(err.syscall, 'queryAny'); |