0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-dns-memory-error.js
Rich Trott 0deb27bd29
test: add dns memory error test
Add test that confirms that when libuv reports a memory error on a DNS
query, that the memory error is passed through and not replaced with
ENOTFOUND.

PR-URL: https://github.com/nodejs/node/pull/20317
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-30 16:49:53 +02:00

16 lines
455 B
JavaScript

// Flags: --expose-internals
'use strict';
// Check that if libuv reports a memory error on a DNS query, that the memory
// error is passed through and not replaced with ENOTFOUND.
require('../common');
const assert = require('assert');
const errors = require('internal/errors');
const { UV_EAI_MEMORY } = process.binding('uv');
const memoryError = errors.dnsException(UV_EAI_MEMORY, 'fhqwhgads');
assert.strictEqual(memoryError.code, 'EAI_MEMORY');