mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: fix IPv6 checks on IBM i
PR-URL: https://github.com/nodejs/node/pull/46546 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
bcf97ab1b2
commit
cb6ef74cf2
3 files changed
+16
-1
No files matched your search
@@ -948,7 +948,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');
|
||||
|
||||
@@ -282,6 +282,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)`);
|
||||
|
||||
@@ -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)`);
|
||||
|
||||
Reference in new issue
Block a user