mirror of
https://github.com/golang/go
synced 2024-11-18 11:14:39 -07:00
net: deflake TestLookupCNAME
Apply the same approach as in CL 102397. Updates #24580 Change-Id: I65955f62a70807c87216519d03f3643a8f214dee Reviewed-on: https://go-review.googlesource.com/103655 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
3b0b8bcd68
commit
598950ca7f
@ -308,9 +308,20 @@ func TestLookupCNAME(t *testing.T) {
|
||||
|
||||
defer dnsWaitGroup.Wait()
|
||||
|
||||
for _, tt := range lookupCNAMETests {
|
||||
attempts := 0
|
||||
for i := 0; i < len(lookupCNAMETests); i++ {
|
||||
tt := lookupCNAMETests[i]
|
||||
cname, err := LookupCNAME(tt.name)
|
||||
if err != nil {
|
||||
testenv.SkipFlakyNet(t)
|
||||
if attempts < len(backoffDuration) {
|
||||
dur := backoffDuration[attempts]
|
||||
t.Logf("backoff %v after failure %v\n", dur, err)
|
||||
time.Sleep(dur)
|
||||
attempts++
|
||||
i--
|
||||
continue
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.HasSuffix(cname, tt.cname) {
|
||||
|
Loading…
Reference in New Issue
Block a user