Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: allow for different nsswitch.conf settings #16378

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/parallel/test-https-connect-address-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function runTest() {

dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => {
if (err) {
if (err.code === 'ENOTFOUND')
if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN')
common.skip('localhost does not resolve to ::1');

throw err;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ const c = net.createConnection(0, 'this.hostname.is.invalid');
c.on('connect', common.mustNotCall());

c.on('error', common.mustCall(function(e) {
assert.strictEqual(e.code, 'ENOTFOUND');
// If Name Service Switch is available on the operating system then it
// might be configured differently (/etc/nsswitch.conf).
// If the system is configured with no dns the error code will be EAI_AGAIN,
// but if there are more services after the dns entry, for example some
// linux distributions ship a myhostname service by default which would
// still produce the ENOTFOUND error.
assert.ok(e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN');
assert.strictEqual(e.port, 0);
assert.strictEqual(e.hostname, 'this.hostname.is.invalid');
}));
8 changes: 7 additions & 1 deletion test/parallel/test-net-connect-immediate-finish.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ const client = net.connect({
client.once('error', common.mustCall((err) => {
assert(err);
assert.strictEqual(err.code, err.errno);
assert.strictEqual(err.code, 'ENOTFOUND');
// If Name Service Switch is available on the operating system then it
// might be configured differently (/etc/nsswitch.conf).
// If the system is configured with no dns the error code will be EAI_AGAIN,
// but if there are more services after the dns entry, for example some
// linux distributions ship a myhostname service by default which would
// still produce the ENOTFOUND error.
assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN');
assert.strictEqual(err.host, err.hostname);
assert.strictEqual(err.host, 'this.hostname.is.invalid');
assert.strictEqual(err.syscall, 'getaddrinfo');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tls-connect-address-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function runTest() {

dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => {
if (err) {
if (err.code === 'ENOTFOUND')
if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN')
common.skip('localhost does not resolve to ::1');

throw err;
Expand Down