Commit 827c5d53 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

[release-branch.go1.12] net: fix test after 8.8.8.8 changed its reverse DNS name

Google's 8.8.8.8 DNS server used to reports its reverse DNS name
as ending in ".google.com". Now it's "dns.google.".

Change-Id: I7dd15f03239e5c3f202e471618ab867690cb4f9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/169679
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit 3089d189)
Reviewed-on: https://go-review.googlesource.com/c/go/+/169717
parent e552f772
...@@ -253,14 +253,11 @@ func TestLookupGmailTXT(t *testing.T) { ...@@ -253,14 +253,11 @@ func TestLookupGmailTXT(t *testing.T) {
} }
} }
var lookupGooglePublicDNSAddrTests = []struct { var lookupGooglePublicDNSAddrTests = []string{
addr, name string "8.8.8.8",
}{ "8.8.4.4",
{"8.8.8.8", ".google.com."}, "2001:4860:4860::8888",
{"8.8.4.4", ".google.com."}, "2001:4860:4860::8844",
{"2001:4860:4860::8888", ".google.com."},
{"2001:4860:4860::8844", ".google.com."},
} }
func TestLookupGooglePublicDNSAddr(t *testing.T) { func TestLookupGooglePublicDNSAddr(t *testing.T) {
...@@ -272,8 +269,8 @@ func TestLookupGooglePublicDNSAddr(t *testing.T) { ...@@ -272,8 +269,8 @@ func TestLookupGooglePublicDNSAddr(t *testing.T) {
defer dnsWaitGroup.Wait() defer dnsWaitGroup.Wait()
for _, tt := range lookupGooglePublicDNSAddrTests { for _, ip := range lookupGooglePublicDNSAddrTests {
names, err := LookupAddr(tt.addr) names, err := LookupAddr(ip)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -281,8 +278,8 @@ func TestLookupGooglePublicDNSAddr(t *testing.T) { ...@@ -281,8 +278,8 @@ func TestLookupGooglePublicDNSAddr(t *testing.T) {
t.Error("got no record") t.Error("got no record")
} }
for _, name := range names { for _, name := range names {
if !strings.HasSuffix(name, tt.name) { if !strings.HasSuffix(name, ".google.com.") && !strings.HasSuffix(name, ".google.") {
t.Errorf("got %s; want a record containing %s", name, tt.name) t.Errorf("got %q; want a record ending in .google.com. or .google.", name)
} }
} }
} }
...@@ -658,8 +655,8 @@ func testDots(t *testing.T, mode string) { ...@@ -658,8 +655,8 @@ func testDots(t *testing.T, mode string) {
t.Errorf("LookupAddr(8.8.8.8): %v (mode=%v)", err, mode) t.Errorf("LookupAddr(8.8.8.8): %v (mode=%v)", err, mode)
} else { } else {
for _, name := range names { for _, name := range names {
if !strings.HasSuffix(name, ".google.com.") { if !strings.HasSuffix(name, ".google.com.") && !strings.HasSuffix(name, ".google.") {
t.Errorf("LookupAddr(8.8.8.8) = %v, want names ending in .google.com. with trailing dot (mode=%v)", names, mode) t.Errorf("LookupAddr(8.8.8.8) = %v, want names ending in .google.com or .google with trailing dot (mode=%v)", names, mode)
break break
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment