From 3504a98b7247a82debcd4f78540b4711c0bbbf41 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Fri, 26 Aug 2016 13:55:00 +0100 Subject: [PATCH] test: fix ::1 error in test-dns-ipv6 If ::1 can't be resolved, the test should still pass. PR-URL: https://github.com/nodejs/node/pull/8254 Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/internet/test-dns-ipv6.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js index f14b45df07ebf2..c1ccc4996eb24d 100644 --- a/test/internet/test-dns-ipv6.js +++ b/test/internet/test-dns-ipv6.js @@ -179,7 +179,12 @@ TEST(function test_lookup_all_ipv6(done) { TEST(function test_lookupservice_ip_ipv6(done) { var req = dns.lookupService('::1', 80, function(err, host, service) { - if (err) throw err; + if (err) { + // Not skipping the test, rather checking an alternative result, + // i.e. that ::1 may not be configured (e.g. in /etc/hosts) + assert.strictEqual(err.code, 'ENOTFOUND'); + return done(); + } assert.equal(typeof host, 'string'); assert(host); assert(['http', 'www', '80'].includes(service));