From 5bef938125d8604593ccacc59474db0b1403f6aa Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 12 Oct 2022 08:28:06 -0700 Subject: [PATCH] net/http: fix some test flakes caused by test refactoring Skip TestTransportPersistConnLeakShortBody in HTTP/2 mode; it's flaky and was previously HTTP/1-only. Don't run TestTransportEventTrace and TestTransportIgnores408 in parallel. Change-Id: I76bc540fac9317185ef7d414c9deafb35bc926b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/442495 Reviewed-by: Bryan Mills Run-TryBot: Damien Neil TryBot-Result: Gopher Robot --- src/net/http/transport_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index 8748cf6f7b..f2b5ab50c8 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -1751,6 +1751,10 @@ func TestTransportPersistConnLeakShortBody(t *testing.T) { run(t, testTransportPersistConnLeakShortBody, testNotParallel) } func testTransportPersistConnLeakShortBody(t *testing.T, mode testMode) { + if mode == http2Mode { + t.Skip("flaky in HTTP/2") + } + // Not parallel: measures goroutines. ts := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { })).ts @@ -4465,14 +4469,14 @@ func testTransportResponseHeaderLength(t *testing.T, mode testMode) { func TestTransportEventTrace(t *testing.T) { run(t, func(t *testing.T, mode testMode) { testTransportEventTrace(t, mode, false) - }) + }, testNotParallel) } // test a non-nil httptrace.ClientTrace but with all hooks set to zero. func TestTransportEventTrace_NoHooks(t *testing.T) { run(t, func(t *testing.T, mode testMode) { testTransportEventTrace(t, mode, true) - }) + }, testNotParallel) } func testTransportEventTrace(t *testing.T, mode testMode, noHooks bool) { @@ -5970,7 +5974,9 @@ func TestIs408(t *testing.T) { } } -func TestTransportIgnores408(t *testing.T) { run(t, testTransportIgnores408, []testMode{http1Mode}) } +func TestTransportIgnores408(t *testing.T) { + run(t, testTransportIgnores408, []testMode{http1Mode}, testNotParallel) +} func testTransportIgnores408(t *testing.T, mode testMode) { // Not parallel. Relies on mutating the log package's global Output. defer log.SetOutput(log.Writer()) -- 2.50.0