aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-07-20 22:16:29 -0400
committerRuss Cox <rsc@golang.org>2015-07-22 20:29:02 +0000
commit5201bf7ad184cac07466016a78b80aed5e472be4 (patch)
tree0d21127bfac978f5209232f01ae28624b7627626 /src
parent75d779566b75fc1a09239bfbca40b6dba42000fd (diff)
downloadgo-5201bf7ad184cac07466016a78b80aed5e472be4.tar.xz
net: do not look up abc by default
Fixes #11665. Change-Id: I0897e8cf695434e77d14dcb1d96f21747edfe37c Reviewed-on: https://go-review.googlesource.com/12523 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/net/ip_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/net/ip_test.go b/src/net/ip_test.go
index 554bb1eaa0..3d95a73c09 100644
--- a/src/net/ip_test.go
+++ b/src/net/ip_test.go
@@ -65,26 +65,28 @@ func TestLookupWithIP(t *testing.T) {
// Test that LookupHost and LookupIP, which normally
// expect host names, work with IP addresses.
for _, tt := range parseIPTests {
- addrs, err := LookupHost(tt.in)
if tt.out != nil {
+ addrs, err := LookupHost(tt.in)
if len(addrs) != 1 || addrs[0] != tt.in || err != nil {
t.Errorf("LookupHost(%q) = %v, %v, want %v, nil", tt.in, addrs, err, []string{tt.in})
}
- } else {
+ } else if !testing.Short() {
// We can't control what the host resolver does; if it can resolve, say,
// 127.0.0.256 or fe80::1%911 or a host named 'abc', who are we to judge?
// Warn about these discrepancies but don't fail the test.
+ addrs, err := LookupHost(tt.in)
if err == nil {
t.Logf("warning: LookupHost(%q) = %v, want error", tt.in, addrs)
}
}
- ips, err := LookupIP(tt.in)
if tt.out != nil {
+ ips, err := LookupIP(tt.in)
if len(ips) != 1 || !reflect.DeepEqual(ips[0], tt.out) || err != nil {
t.Errorf("LookupIP(%q) = %v, %v, want %v, nil", tt.in, ips, err, []IP{tt.out})
}
- } else {
+ } else if !testing.Short() {
+ ips, err := LookupIP(tt.in)
// We can't control what the host resolver does. See above.
if err == nil {
t.Logf("warning: LookupIP(%q) = %v, want error", tt.in, ips)