summaryrefslogtreecommitdiff
path: root/test/internet
diff options
context:
space:
mode:
authorAlexis Campailla <alexis@janeasystems.com>2014-08-12 16:48:02 +0200
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-08-13 11:44:20 -0700
commit0d357fa135dedaae644d73b0b9a907b90c66f200 (patch)
tree606729f57a27ad02f096cf7e15abbea01f2ffd91 /test/internet
parent0565d52a71313ca1334fa89f11cb626e4bc2b522 (diff)
downloadnodejs-0d357fa135dedaae644d73b0b9a907b90c66f200.tar.gz
nodejs-0d357fa135dedaae644d73b0b9a907b90c66f200.tar.bz2
nodejs-0d357fa135dedaae644d73b0b9a907b90c66f200.zip
test: fix dns test
Fix a few issues in test/internet/test-dns.js: - 'hint' should be 'hints' - reverse name lookup is not guaranteed to return 'localhost' - V4MAPPED hint requires IPV6 address family Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
Diffstat (limited to 'test/internet')
-rw-r--r--test/internet/test-dns.js19
1 files changed, 6 insertions, 13 deletions
diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js
index 202f08e8d..35a2e6b9b 100644
--- a/test/internet/test-dns.js
+++ b/test/internet/test-dns.js
@@ -63,7 +63,6 @@ function checkWrap(req) {
assert.ok(typeof req === 'object');
}
-
TEST(function test_resolve4(done) {
var req = dns.resolve4('www.google.com', function(err, ips) {
if (err) throw err;
@@ -354,7 +353,7 @@ TEST(function test_lookup_ipv4_explicit_object(done) {
TEST(function test_lookup_ipv4_hint_addrconfig(done) {
var req = dns.lookup('www.google.com', {
- hint: dns.ADDRCONFIG
+ hints: dns.ADDRCONFIG
}, function(err, ip, family) {
if (err) throw err;
assert.ok(net.isIPv4(ip));
@@ -411,8 +410,9 @@ TEST(function test_lookup_ipv6_explicit_object(done) {
TEST(function test_lookup_ipv6_hint(done) {
- var req = dns.lookup('ipv6.google.com', {
- hint: dns.V4MAPPED
+ var req = dns.lookup('www.google.com', {
+ family: 6,
+ hints: dns.V4MAPPED
}, function(err, ip, family) {
if (err) throw err;
assert.ok(net.isIPv6(ip));
@@ -494,7 +494,7 @@ TEST(function test_lookup_localhost_ipv4(done) {
TEST(function test_lookupservice_ip_ipv4(done) {
var req = dns.lookupService('127.0.0.1', 80, function(err, host, service) {
if (err) throw err;
- assert.strictEqual(host, 'localhost');
+ assert.ok(common.isValidHostname(host));
/*
* Retrieve the actual HTTP service name as setup on the host currently
@@ -523,14 +523,7 @@ 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;
- /*
- * 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.ok(common.isValidHostname(host));
/*
* Retrieve the actual HTTP service name as setup on the host currently