Skip to content

Commit cb6ef74

Browse files
abmussetargos
authored andcommitted
test: fix IPv6 checks on IBM i
PR-URL: #46546 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent bcf97ab commit cb6ef74

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

test/common/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,14 @@ const common = {
948948

949949
get hasIPv6() {
950950
const iFaces = require('os').networkInterfaces();
951-
const re = isWindows ? /Loopback Pseudo-Interface/ : /lo/;
951+
let re;
952+
if (isWindows) {
953+
re = /Loopback Pseudo-Interface/;
954+
} else if (this.isIBMi) {
955+
re = /\*LOOPBACK/;
956+
} else {
957+
re = /lo/;
958+
}
952959
return Object.keys(iFaces).some((name) => {
953960
return re.test(name) &&
954961
iFaces[name].some(({ family }) => family === 'IPv6');

test/parallel/test-net-autoselectfamily.js

+4
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ if (common.hasIPv6) {
282282
assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`);
283283
} else if (error.code === 'EAFNOSUPPORT') {
284284
assert.strictEqual(error.message, `connect EAFNOSUPPORT ::1:${port} - Local (undefined:undefined)`);
285+
} else if (common.isIBMi) {
286+
// IBMi returns EUNATCH (ERRNO 42) when IPv6 is disabled
287+
// keep this errno assertion until EUNATCH is recognized by libuv
288+
assert.strictEqual(error.errno, -42);
285289
} else {
286290
assert.strictEqual(error.code, 'EADDRNOTAVAIL');
287291
assert.strictEqual(error.message, `connect EADDRNOTAVAIL ::1:${port} - Local (:::0)`);

test/parallel/test-net-autoselectfamilydefault.js

+4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ function createDnsServer(ipv6Addr, ipv4Addr, cb) {
129129
assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`);
130130
} else if (error.code === 'EAFNOSUPPORT') {
131131
assert.strictEqual(error.message, `connect EAFNOSUPPORT ::1:${port} - Local (undefined:undefined)`);
132+
} else if (common.isIBMi) {
133+
// IBMi returns EUNATCH (ERRNO 42) when IPv6 is disabled
134+
// keep this errno assertion until EUNATCH is recognized by libuv
135+
assert.strictEqual(error.errno, -42);
132136
} else {
133137
assert.strictEqual(error.code, 'EADDRNOTAVAIL');
134138
assert.strictEqual(error.message, `connect EADDRNOTAVAIL ::1:${port} - Local (:::0)`);

0 commit comments

Comments
 (0)