1
0
mirror of https://github.com/golang/go synced 2024-11-12 01:10:21 -07:00

net: pass if at least one matching entry in TestLookupGmailTXT

Fixes #29698

Change-Id: I0531c0a274b120af8871aa2f5975744ff6c912a3
Reviewed-on: https://go-review.googlesource.com/c/157638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2019-01-11 14:26:24 -08:00
parent a2bb68de4d
commit 7cbfa55b5d

View File

@ -237,11 +237,16 @@ func TestLookupGmailTXT(t *testing.T) {
if len(txts) == 0 { if len(txts) == 0 {
t.Error("got no record") t.Error("got no record")
} }
found := false
for _, txt := range txts { for _, txt := range txts {
if !strings.Contains(txt, tt.txt) || (!strings.HasSuffix(txt, tt.host) && !strings.HasSuffix(txt, tt.host+".")) { if strings.Contains(txt, tt.txt) && (strings.HasSuffix(txt, tt.host) || strings.HasSuffix(txt, tt.host+".")) {
t.Errorf("got %s; want a record containing %s, %s", txt, tt.txt, tt.host) found = true
break
} }
} }
if !found {
t.Errorf("got %v; want a record containing %s, %s", txts, tt.txt, tt.host)
}
} }
} }