Skip to content

Commit

Permalink
test: allow EAI_FAIL in test-http-dns-error.js
Browse files Browse the repository at this point in the history
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: nodejs#27500
Fixes: nodejs#27487
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
cjihrig committed May 3, 2019
1 parent d0667e8 commit 50364d9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/parallel/test-http-dns-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand All @@ -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();
}
Expand Down

0 comments on commit 50364d9

Please sign in to comment.