test: allow EAI_FAIL in test-http-dns-error.js

EAI_FAIL is expected on OpenBSD, and has been observed on
platforms such as FreeBSD and Windows. This commit makes
EAI_FAIL an acceptable error code on all platforms.

PR-URL: https://github.com/nodejs/node/pull/27500
Fixes: https://github.com/nodejs/node/issues/27487
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
cjihrig 2019-04-30 14:31:20 -04:00
parent d0667e814e
commit 50364d98d9
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -32,9 +32,7 @@ const https = require('https');
const host = '*'.repeat(64);
const MAX_TRIES = 5;
let errCode = 'ENOTFOUND';
if (common.isOpenBSD)
errCode = 'EAI_FAIL';
const errCodes = ['ENOTFOUND', 'EAI_FAIL'];
function tryGet(mod, tries) {
// Bad host name should not throw an uncatchable exception.
@ -45,7 +43,7 @@ function tryGet(mod, tries) {
tryGet(mod, ++tries);
return;
}
assert.strictEqual(err.code, errCode);
assert(errCodes.includes(err.code), err);
}));
// http.get() called req1.end() for us
}
@ -61,7 +59,7 @@ function tryRequest(mod, tries) {
tryRequest(mod, ++tries);
return;
}
assert.strictEqual(err.code, errCode);
assert(errCodes.includes(err.code), err);
}));
req.end();
}