mirror of https://github.com/golang/go.git
[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: Dmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit 3089d18956)
Reviewed-on: https://go-review.googlesource.com/c/go/+/169717
This commit is contained in:
parent
e552f772f7
commit
827c5d5355
|
|
@ -253,14 +253,11 @@ func TestLookupGmailTXT(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
var lookupGooglePublicDNSAddrTests = []struct {
|
||||
addr, name string
|
||||
}{
|
||||
{"8.8.8.8", ".google.com."},
|
||||
{"8.8.4.4", ".google.com."},
|
||||
|
||||
{"2001:4860:4860::8888", ".google.com."},
|
||||
{"2001:4860:4860::8844", ".google.com."},
|
||||
var lookupGooglePublicDNSAddrTests = []string{
|
||||
"8.8.8.8",
|
||||
"8.8.4.4",
|
||||
"2001:4860:4860::8888",
|
||||
"2001:4860:4860::8844",
|
||||
}
|
||||
|
||||
func TestLookupGooglePublicDNSAddr(t *testing.T) {
|
||||
|
|
@ -272,8 +269,8 @@ func TestLookupGooglePublicDNSAddr(t *testing.T) {
|
|||
|
||||
defer dnsWaitGroup.Wait()
|
||||
|
||||
for _, tt := range lookupGooglePublicDNSAddrTests {
|
||||
names, err := LookupAddr(tt.addr)
|
||||
for _, ip := range lookupGooglePublicDNSAddrTests {
|
||||
names, err := LookupAddr(ip)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -281,8 +278,8 @@ func TestLookupGooglePublicDNSAddr(t *testing.T) {
|
|||
t.Error("got no record")
|
||||
}
|
||||
for _, name := range names {
|
||||
if !strings.HasSuffix(name, tt.name) {
|
||||
t.Errorf("got %s; want a record containing %s", name, tt.name)
|
||||
if !strings.HasSuffix(name, ".google.com.") && !strings.HasSuffix(name, ".google.") {
|
||||
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) {
|
|||
t.Errorf("LookupAddr(8.8.8.8): %v (mode=%v)", err, mode)
|
||||
} else {
|
||||
for _, name := range names {
|
||||
if !strings.HasSuffix(name, ".google.com.") {
|
||||
t.Errorf("LookupAddr(8.8.8.8) = %v, want names ending in .google.com. with trailing dot (mode=%v)", names, mode)
|
||||
if !strings.HasSuffix(name, ".google.com.") && !strings.HasSuffix(name, ".google.") {
|
||||
t.Errorf("LookupAddr(8.8.8.8) = %v, want names ending in .google.com or .google with trailing dot (mode=%v)", names, mode)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue