From 6ad01fd7b5a907cc404cdf34cc07a374c7c74d9f Mon Sep 17 00:00:00 2001 From: Livia Medeiros Date: Sun, 19 Feb 2023 01:32:05 +0900 Subject: [PATCH] test: fix `test-net-autoselectfamily` for kernel without IPv6 support PR-URL: https://github.com/nodejs/node/pull/45856 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Paolo Insogna --- test/parallel/test-net-autoselectfamily.js | 2 ++ test/parallel/test-net-autoselectfamilydefault.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/parallel/test-net-autoselectfamily.js b/test/parallel/test-net-autoselectfamily.js index d664d8c15b9572..777fe357e89434 100644 --- a/test/parallel/test-net-autoselectfamily.js +++ b/test/parallel/test-net-autoselectfamily.js @@ -215,6 +215,8 @@ if (common.hasIPv6) { if (common.hasIPv6) { assert.strictEqual(error.code, 'ECONNREFUSED'); 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 { 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 4b9c7c36a8be83..a3faa9c3c1e118 100644 --- a/test/parallel/test-net-autoselectfamilydefault.js +++ b/test/parallel/test-net-autoselectfamilydefault.js @@ -127,6 +127,8 @@ function createDnsServer(ipv6Addr, ipv4Addr, cb) { if (common.hasIPv6) { assert.strictEqual(error.code, 'ECONNREFUSED'); 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 { assert.strictEqual(error.code, 'EADDRNOTAVAIL'); assert.strictEqual(error.message, `connect EADDRNOTAVAIL ::1:${port} - Local (:::0)`);