aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/clientserver_test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2023-03-17 12:42:02 -0400
committerGopher Robot <gobot@golang.org>2023-03-17 17:21:50 +0000
commit729c05d06524eabcf0b4ed097f94d70aba48de8a (patch)
treebdf525fd6597b78c40ec6d2b8e6f2df50e2e8201 /src/net/http/clientserver_test.go
parent2449bbb5e614954ce9e99c8a481ea2ee73d72d61 (diff)
downloadgo-729c05d06524eabcf0b4ed097f94d70aba48de8a.tar.xz
net/http: eliminate more arbitrary timeouts in tests
Change-Id: I5b3158ecd0eb20dc433a53a2b03eb4551cbb3f7d Reviewed-on: https://go-review.googlesource.com/c/go/+/477196 Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/net/http/clientserver_test.go')
-rw-r--r--src/net/http/clientserver_test.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/net/http/clientserver_test.go b/src/net/http/clientserver_test.go
index e49bed113a..58321532ea 100644
--- a/src/net/http/clientserver_test.go
+++ b/src/net/http/clientserver_test.go
@@ -1283,24 +1283,28 @@ func testInterruptWithPanic(t *testing.T, mode testMode, panicValue any) {
}
wantStackLogged := panicValue != nil && panicValue != ErrAbortHandler
- if err := waitErrCondition(5*time.Second, 10*time.Millisecond, func() error {
+ waitCondition(t, 10*time.Millisecond, func(d time.Duration) bool {
gotLog := logOutput()
if !wantStackLogged {
if gotLog == "" {
- return nil
+ return true
}
- return fmt.Errorf("want no log output; got: %s", gotLog)
+ t.Fatalf("want no log output; got: %s", gotLog)
}
if gotLog == "" {
- return fmt.Errorf("wanted a stack trace logged; got nothing")
+ if d > 0 {
+ t.Logf("wanted a stack trace logged; got nothing after %v", d)
+ }
+ return false
}
if !strings.Contains(gotLog, "created by ") && strings.Count(gotLog, "\n") < 6 {
- return fmt.Errorf("output doesn't look like a panic stack trace. Got: %s", gotLog)
+ if d > 0 {
+ t.Logf("output doesn't look like a panic stack trace after %v. Got: %s", d, gotLog)
+ }
+ return false
}
- return nil
- }); err != nil {
- t.Fatal(err)
- }
+ return true
+ })
}
type lockedBytesBuffer struct {