diff options
| author | Bryan C. Mills <bcmills@google.com> | 2020-03-11 10:24:14 -0400 |
|---|---|---|
| committer | Bryan C. Mills <bcmills@google.com> | 2020-03-11 15:55:54 +0000 |
| commit | 0e3ace42f5a06a2472662da08105d6c956f4eef1 (patch) | |
| tree | 330eabb4dec6d29f5a28785300ee19cc702d57e9 /src/net/http | |
| parent | 035c018d40c0a7895880e235048d425ea3e3fa6b (diff) | |
| download | go-0e3ace42f5a06a2472662da08105d6c956f4eef1.tar.xz | |
net/http: use t.Deadline instead of an arbitrary timeout in TestServerConnState
Updates #37322
Change-Id: I3b8369cd9e0ed5e4b3136cedaa2f70698ead2270
Reviewed-on: https://go-review.googlesource.com/c/go/+/222957
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Diffstat (limited to 'src/net/http')
| -rw-r--r-- | src/net/http/serve_test.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index aa6d87251d..21ee7f33c8 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -4135,10 +4135,19 @@ func TestServerConnState(t *testing.T) { doRequests() - timer := time.NewTimer(5 * time.Second) + stateDelay := 5 * time.Second + if deadline, ok := t.Deadline(); ok { + // Allow an arbitrarily long delay. + // This test was observed to be flaky on the darwin-arm64-corellium builder, + // so we're increasing the deadline to see if it starts passing. + // See https://golang.org/issue/37322. + const arbitraryCleanupMargin = 1 * time.Second + stateDelay = time.Until(deadline) - arbitraryCleanupMargin + } + timer := time.NewTimer(stateDelay) select { case <-timer.C: - t.Errorf("Timed out waiting for connection to change state.") + t.Errorf("Timed out after %v waiting for connection to change state.", stateDelay) case <-complete: timer.Stop() } |
