1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:40:02 -07:00

net/http: remove arbitrary timeout from TestTransportGCRequest

This test expects a *Request to be garbage collected
within five seconds. Some slow builders take longer.
Drop the arbitrary timeout.

Fixes #56809

Change-Id: I4b5bdce09002a5b52b7b5d0b33e7876d48740bc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/522615
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Damien Neil 2023-08-24 10:12:38 -07:00
parent 5374c1aaf5
commit 99a174f06e

View File

@ -1172,16 +1172,12 @@ func testTransportGCRequest(t *testing.T, mode testMode, body bool) {
t.Fatal(err)
}
})()
timeout := time.NewTimer(5 * time.Second)
defer timeout.Stop()
for {
select {
case <-didGC:
return
case <-time.After(100 * time.Millisecond):
case <-time.After(1 * time.Millisecond):
runtime.GC()
case <-timeout.C:
t.Fatal("never saw GC of request")
}
}
}