diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-01-11 14:26:24 -0800 |
---|---|---|
committer | Filippo Valsorda <valsorda@google.com> | 2019-01-23 19:05:45 +0000 |
commit | ed3af1d472dad80cf070848917b80276ecb6a652 (patch) | |
tree | 9334d0eac0a47e5e723c6dbaaf5fe31ccee472ad | |
parent | d4cad3c4b15a6364d8d98424ee264559f3dd5bdb (diff) | |
download | go-ed3af1d472dad80cf070848917b80276ecb6a652.tar.gz go-ed3af1d472dad80cf070848917b80276ecb6a652.zip |
[release-branch.go1.10-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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://team-review.git.corp.google.com/c/401204
Reviewed-by: Filippo Valsorda <valsorda@google.com>
-rw-r--r-- | src/net/lookup_test.go | 9 |
1 files 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) + } } } |