]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: fix some test flakes caused by test refactoring
authorDamien Neil <dneil@google.com>
Wed, 12 Oct 2022 15:28:06 +0000 (08:28 -0700)
committerDamien Neil <dneil@google.com>
Wed, 12 Oct 2022 18:11:14 +0000 (18:11 +0000)
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 <bcmills@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/net/http/transport_test.go

index 8748cf6f7b6eb31675e6f26260ad2cd75dd02076..f2b5ab50c83378c2ca9ff6a036b421c6ced4aa81 100644 (file)
@@ -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())