From c731a7daf4e0db719c944f3c2073bed86c9fbf51 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 11 Jan 2019 14:26:24 -0800 Subject: [release-branch.go1.10] net: pass if at least one matching entry in TestLookupGmailTXT Updates #29698 Fixes #29699 Change-Id: I0531c0a274b120af8871aa2f5975744ff6c912a3 Reviewed-on: https://go-review.googlesource.com/c/157638 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick (cherry picked from commit 7cbfa55b5d17c8deaecff05e4221f828467cfa97) Reviewed-on: https://go-review.googlesource.com/c/157640 --- src/net/lookup_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go index 24787ccf2b..01901e6217 100644 --- a/src/net/lookup_test.go +++ b/src/net/lookup_test.go @@ -184,11 +184,16 @@ func TestLookupGmailTXT(t *testing.T) { if len(txts) == 0 { t.Error("got no record") } + found := false for _, txt := range txts { - 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) + if strings.Contains(txt, tt.txt) && (strings.HasSuffix(txt, tt.host) || strings.HasSuffix(txt, tt.host+".")) { + found = true + break } } + if !found { + t.Errorf("got %v; want a record containing %s, %s", txts, tt.txt, tt.host) + } } } -- cgit v1.2.3-54-g00ecf