diff --git a/test/common/index.js b/test/common/index.js index d6fddac2d5d864..f399465f3d5aba 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -940,7 +940,14 @@ const common = { get hasIPv6() { const iFaces = require('os').networkInterfaces(); - const re = isWindows ? /Loopback Pseudo-Interface/ : /lo/; + let re; + if (isWindows) { + re = /Loopback Pseudo-Interface/; + } else if (this.isIBMi) { + re = /\*LOOPBACK/; + } else { + re = /lo/; + } return Object.keys(iFaces).some((name) => { return re.test(name) && iFaces[name].some(({ family }) => family === 'IPv6'); diff --git a/test/parallel/test-net-autoselectfamily.js b/test/parallel/test-net-autoselectfamily.js index 2ca8d12b5f5346..8deff524203316 100644 --- a/test/parallel/test-net-autoselectfamily.js +++ b/test/parallel/test-net-autoselectfamily.js @@ -217,6 +217,10 @@ if (common.hasIPv6) { assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`); } else if (error.code === 'EAFNOSUPPORT') { assert.strictEqual(error.message, `connect EAFNOSUPPORT ::1:${port} - Local (undefined:undefined)`); + } else if (common.isIBMi) { + // IBMi returns EUNATCH (ERRNO 42) when IPv6 is disabled + // keep this errno assertion until EUNATCH is recognized by libuv + assert.strictEqual(error.errno, -42); } else { assert.strictEqual(error.code, 'EADDRNOTAVAIL'); assert.strictEqual(error.message, `connect EADDRNOTAVAIL ::1:${port} - Local (:::0)`); diff --git a/test/parallel/test-net-autoselectfamilydefault.js b/test/parallel/test-net-autoselectfamilydefault.js index a3faa9c3c1e118..be110a836a057b 100644 --- a/test/parallel/test-net-autoselectfamilydefault.js +++ b/test/parallel/test-net-autoselectfamilydefault.js @@ -129,6 +129,10 @@ function createDnsServer(ipv6Addr, ipv4Addr, cb) { assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`); } else if (error.code === 'EAFNOSUPPORT') { assert.strictEqual(error.message, `connect EAFNOSUPPORT ::1:${port} - Local (undefined:undefined)`); + } else if (common.isIBMi) { + // IBMi returns EUNATCH (ERRNO 42) when IPv6 is disabled + // keep this errno assertion until EUNATCH is recognized by libuv + assert.strictEqual(error.errno, -42); } else { assert.strictEqual(error.code, 'EADDRNOTAVAIL'); assert.strictEqual(error.message, `connect EADDRNOTAVAIL ::1:${port} - Local (:::0)`);