From 1609ba19c68b1c52793cc7c4c8ed890cb8dfe4ca Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 25 Apr 2018 20:39:19 -0700 Subject: [PATCH] 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. --- test/parallel/test-dns-memory-error.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/parallel/test-dns-memory-error.js diff --git a/test/parallel/test-dns-memory-error.js b/test/parallel/test-dns-memory-error.js new file mode 100644 index 00000000000000..2048ad4c4ea6d3 --- /dev/null +++ b/test/parallel/test-dns-memory-error.js @@ -0,0 +1,15 @@ +// 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');