Skip to content

Commit daef79d

Browse files
ianlancetaylorFiloSottile
authored andcommitted
[release-branch.go1.11-security] 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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-on: https://team-review.git.corp.google.com/c/401203 Reviewed-by: Filippo Valsorda <[email protected]>
1 parent 983d809 commit daef79d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/net/lookup_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,16 @@ func TestLookupGmailTXT(t *testing.T) {
237237
if len(txts) == 0 {
238238
t.Error("got no record")
239239
}
240+
found := false
240241
for _, txt := range txts {
241-
if !strings.Contains(txt, tt.txt) || (!strings.HasSuffix(txt, tt.host) && !strings.HasSuffix(txt, tt.host+".")) {
242-
t.Errorf("got %s; want a record containing %s, %s", txt, tt.txt, tt.host)
242+
if strings.Contains(txt, tt.txt) && (strings.HasSuffix(txt, tt.host) || strings.HasSuffix(txt, tt.host+".")) {
243+
found = true
244+
break
243245
}
244246
}
247+
if !found {
248+
t.Errorf("got %v; want a record containing %s, %s", txts, tt.txt, tt.host)
249+
}
245250
}
246251
}
247252

0 commit comments

Comments
 (0)