From 0381cf5698825a7e72de850bae0616e1108f21d3 Mon Sep 17 00:00:00 2001 From: Julien Gilli Date: Tue, 29 Jul 2014 18:06:47 -0700 Subject: [PATCH] tests: fix internet/test-dns.js internet/test-dns.js assumes that ::1 always resolves to "localhost" on all platforms. This is not what happens in reality. Some platforms resolve it to "ip6-localhost" too. There doesn't seem to be any consensus on what's the right thing to do. However, most sane platforms will use either one of these two values. Reviewed-by: Trevor Norris --- test/internet/test-dns.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 0c5e436502..6165b30a3a 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -447,7 +447,14 @@ TEST(function test_lookupservice_ip_ipv4(done) { TEST(function test_lookupservice_ip_ipv6(done) { var req = dns.lookupService('::1', 80, function(err, host, service) { if (err) throw err; - assert.strictEqual(host, 'localhost'); + /* + * On some systems, ::1 can be set to "localhost", on others it + * can be set to "ip6-localhost". There does not seem to be + * a consensus on that. Ultimately, it could be set to anything + * else just by changing /etc/hosts for instance, but it seems + * that most sane platforms use either one of these two by default. + */ + assert(host === 'localhost' || host === 'ip6-localhost'); assert.strictEqual(service, 'http'); done();