summaryrefslogtreecommitdiff
path: root/src/pkg/net/lookup_test.go
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /src/pkg/net/lookup_test.go
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-upstream/1.1_hg20130304.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'src/pkg/net/lookup_test.go')
-rw-r--r--src/pkg/net/lookup_test.go36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/pkg/net/lookup_test.go b/src/pkg/net/lookup_test.go
index 3a61dfb29..3355e4694 100644
--- a/src/pkg/net/lookup_test.go
+++ b/src/pkg/net/lookup_test.go
@@ -9,6 +9,7 @@ package net
import (
"flag"
+ "strings"
"testing"
)
@@ -16,8 +17,7 @@ var testExternal = flag.Bool("external", true, "allow use of external networks d
func TestGoogleSRV(t *testing.T) {
if testing.Short() || !*testExternal {
- t.Logf("skipping test to avoid external network")
- return
+ t.Skip("skipping test to avoid external network")
}
_, addrs, err := LookupSRV("xmpp-server", "tcp", "google.com")
if err != nil {
@@ -39,8 +39,7 @@ func TestGoogleSRV(t *testing.T) {
func TestGmailMX(t *testing.T) {
if testing.Short() || !*testExternal {
- t.Logf("skipping test to avoid external network")
- return
+ t.Skip("skipping test to avoid external network")
}
mx, err := LookupMX("gmail.com")
if err != nil {
@@ -51,10 +50,22 @@ func TestGmailMX(t *testing.T) {
}
}
+func TestGmailNS(t *testing.T) {
+ if testing.Short() || !*testExternal {
+ t.Skip("skipping test to avoid external network")
+ }
+ ns, err := LookupNS("gmail.com")
+ if err != nil {
+ t.Errorf("failed: %s", err)
+ }
+ if len(ns) == 0 {
+ t.Errorf("no results")
+ }
+}
+
func TestGmailTXT(t *testing.T) {
if testing.Short() || !*testExternal {
- t.Logf("skipping test to avoid external network")
- return
+ t.Skip("skipping test to avoid external network")
}
txt, err := LookupTXT("gmail.com")
if err != nil {
@@ -67,8 +78,7 @@ func TestGmailTXT(t *testing.T) {
func TestGoogleDNSAddr(t *testing.T) {
if testing.Short() || !*testExternal {
- t.Logf("skipping test to avoid external network")
- return
+ t.Skip("skipping test to avoid external network")
}
names, err := LookupAddr("8.8.8.8")
if err != nil {
@@ -79,6 +89,16 @@ func TestGoogleDNSAddr(t *testing.T) {
}
}
+func TestLookupIANACNAME(t *testing.T) {
+ if testing.Short() || !*testExternal {
+ t.Skip("skipping test to avoid external network")
+ }
+ cname, err := LookupCNAME("www.iana.org")
+ if !strings.HasSuffix(cname, ".icann.org.") || err != nil {
+ t.Errorf(`LookupCNAME("www.iana.org.") = %q, %v, want "*.icann.org.", nil`, cname, err)
+ }
+}
+
var revAddrTests = []struct {
Addr string
Reverse string