diff options
Diffstat (limited to 'src/net/http/serve_test.go')
| -rw-r--r-- | src/net/http/serve_test.go | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index f2ba8705d1..d9a1898cc9 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -815,7 +815,7 @@ func testServerTimeoutsWithTimeout(t *testing.T, timeout time.Duration, mode tes return nil } -func TestServerReadTimeout(t *testing.T) { run(t, testServerReadTimeout) } +func TestServerReadTimeout(t *testing.T) { run(t, testServerReadTimeout, http3SkippedMode) } func testServerReadTimeout(t *testing.T, mode testMode) { respBody := "response body" for timeout := 5 * time.Millisecond; ; timeout *= 2 { @@ -900,7 +900,7 @@ func testServerNoReadTimeout(t *testing.T, mode testMode) { } } -func TestServerWriteTimeout(t *testing.T) { run(t, testServerWriteTimeout) } +func TestServerWriteTimeout(t *testing.T) { run(t, testServerWriteTimeout, http3SkippedMode) } func testServerWriteTimeout(t *testing.T, mode testMode) { for timeout := 5 * time.Millisecond; ; timeout *= 2 { errc := make(chan error, 2) @@ -965,7 +965,10 @@ func testServerWriteTimeout(t *testing.T, mode testMode) { } } -func TestServerNoWriteTimeout(t *testing.T) { run(t, testServerNoWriteTimeout) } +func TestServerNoWriteTimeout(t *testing.T) { + // Trips off race detector for HTTP/3. + run(t, testServerNoWriteTimeout, http3SkippedMode) +} func testServerNoWriteTimeout(t *testing.T, mode testMode) { for _, timeout := range []time.Duration{0, -1} { cst := newClientServerTest(t, mode, HandlerFunc(func(res ResponseWriter, req *Request) { @@ -1050,7 +1053,7 @@ func TestWriteDeadlineEnforcedPerStream(t *testing.T) { tryTimeouts(t, func(timeout time.Duration) error { return testWriteDeadlineEnforcedPerStream(t, mode, timeout) }) - }) + }, http3SkippedMode) } func testWriteDeadlineEnforcedPerStream(t *testing.T, mode testMode, timeout time.Duration) error { @@ -1548,7 +1551,7 @@ func testServerAllowsBlockingRemoteAddr(t *testing.T, mode testMode) { // TestHeadResponses verifies that all MIME type sniffing and Content-Length // counting of GET requests also happens on HEAD requests. -func TestHeadResponses(t *testing.T) { run(t, testHeadResponses) } +func TestHeadResponses(t *testing.T) { run(t, testHeadResponses, http3SkippedMode) } func testHeadResponses(t *testing.T, mode testMode) { cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { _, err := w.Write([]byte("<html>")) @@ -2920,7 +2923,7 @@ func TestTimeoutHandlerPanicRecovery(t *testing.T) { } run(t, func(t *testing.T, mode testMode) { testHandlerPanic(t, false, mode, wrapper, "intentional death for testing") - }, testNotParallel) + }, testNotParallel, http3SkippedMode) } func TestRedirectBadPath(t *testing.T) { @@ -3093,13 +3096,13 @@ func testZeroLengthPostAndResponse(t *testing.T, mode testMode) { func TestHandlerPanicNil(t *testing.T) { run(t, func(t *testing.T, mode testMode) { testHandlerPanic(t, false, mode, nil, nil) - }, testNotParallel) + }, testNotParallel, http3SkippedMode) } func TestHandlerPanic(t *testing.T) { run(t, func(t *testing.T, mode testMode) { testHandlerPanic(t, false, mode, nil, "intentional death for testing") - }, testNotParallel) + }, testNotParallel, http3SkippedMode) } func TestHandlerPanicWithHijack(t *testing.T) { @@ -3285,7 +3288,7 @@ func TestStripPrefixNotModifyRequest(t *testing.T) { } } -func TestRequestLimit(t *testing.T) { run(t, testRequestLimit) } +func TestRequestLimit(t *testing.T) { run(t, testRequestLimit, http3SkippedMode) } func testRequestLimit(t *testing.T, mode testMode) { cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { t.Fatalf("didn't expect to get request in Handler") @@ -3362,7 +3365,10 @@ func (r *bodyLimitReader) Close() error { return nil } -func TestRequestBodyLimit(t *testing.T) { run(t, testRequestBodyLimit) } +func TestRequestBodyLimit(t *testing.T) { + // Trips off race detector for HTTP/3. + run(t, testRequestBodyLimit, http3SkippedMode) +} func testRequestBodyLimit(t *testing.T, mode testMode) { const limit = 1 << 20 cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { @@ -3414,7 +3420,7 @@ func testRequestBodyLimit(t *testing.T, mode testMode) { // TestClientWriteShutdown tests that if the client shuts down the write // side of their TCP connection, the server doesn't send a 400 Bad Request. -func TestClientWriteShutdown(t *testing.T) { run(t, testClientWriteShutdown) } +func TestClientWriteShutdown(t *testing.T) { run(t, testClientWriteShutdown, http3SkippedMode) } func testClientWriteShutdown(t *testing.T, mode testMode) { if runtime.GOOS == "plan9" { t.Skip("skipping test; see https://golang.org/issue/17906") @@ -4310,7 +4316,7 @@ func TestContentTypeOkayOn204(t *testing.T) { // and the http client), and both think they can close it on failure. // Therefore, all incoming server requests Bodies need to be thread-safe. func TestTransportAndServerSharedBodyRace(t *testing.T) { - run(t, testTransportAndServerSharedBodyRace, testNotParallel) + run(t, testTransportAndServerSharedBodyRace, testNotParallel, http3SkippedMode) } func testTransportAndServerSharedBodyRace(t *testing.T, mode testMode) { // The proxy server in the middle of the stack for this test potentially @@ -5178,7 +5184,7 @@ func TestServerValidatesHeaders(t *testing.T) { } func TestServerRequestContextCancel_ServeHTTPDone(t *testing.T) { - run(t, testServerRequestContextCancel_ServeHTTPDone) + run(t, testServerRequestContextCancel_ServeHTTPDone, http3SkippedMode) } func testServerRequestContextCancel_ServeHTTPDone(t *testing.T, mode testMode) { ctxc := make(chan context.Context, 1) @@ -5231,7 +5237,7 @@ func testServerRequestContextCancel_ConnClose(t *testing.T, mode testMode) { } func TestServerContext_ServerContextKey(t *testing.T) { - run(t, testServerContext_ServerContextKey) + run(t, testServerContext_ServerContextKey, http3SkippedMode) } func testServerContext_ServerContextKey(t *testing.T, mode testMode) { cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { @@ -5249,7 +5255,7 @@ func testServerContext_ServerContextKey(t *testing.T, mode testMode) { } func TestServerContext_LocalAddrContextKey(t *testing.T) { - run(t, testServerContext_LocalAddrContextKey) + run(t, testServerContext_LocalAddrContextKey, http3SkippedMode) } func testServerContext_LocalAddrContextKey(t *testing.T, mode testMode) { ch := make(chan any, 1) @@ -5944,7 +5950,7 @@ func testServerSetKeepAlivesEnabledClosesConns(t *testing.T, mode testMode) { // exact same ports from the previous connection. } -func TestServerShutdown(t *testing.T) { run(t, testServerShutdown) } +func TestServerShutdown(t *testing.T) { run(t, testServerShutdown, http3SkippedMode) } func testServerShutdown(t *testing.T, mode testMode) { var cst *clientServerTest @@ -6005,7 +6011,9 @@ func testServerShutdown(t *testing.T, mode testMode) { } } -func TestServerShutdownStateNew(t *testing.T) { runSynctest(t, testServerShutdownStateNew) } +func TestServerShutdownStateNew(t *testing.T) { + runSynctest(t, testServerShutdownStateNew, http3SkippedMode) +} func testServerShutdownStateNew(t *testing.T, mode testMode) { if testing.Short() { t.Skip("test takes 5-6 seconds; skipping in short mode") @@ -6070,7 +6078,9 @@ func TestServerCloseDeadlock(t *testing.T) { // Issue 17717: tests that Server.SetKeepAlivesEnabled is respected by // both HTTP/1 and HTTP/2. -func TestServerKeepAlivesEnabled(t *testing.T) { runSynctest(t, testServerKeepAlivesEnabled) } +func TestServerKeepAlivesEnabled(t *testing.T) { + runSynctest(t, testServerKeepAlivesEnabled, http3SkippedMode) +} func testServerKeepAlivesEnabled(t *testing.T, mode testMode) { cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) {}), optFakeNet) defer cst.close() @@ -6556,7 +6566,7 @@ func TestStripPortFromHost(t *testing.T) { } } -func TestServerContexts(t *testing.T) { run(t, testServerContexts) } +func TestServerContexts(t *testing.T) { run(t, testServerContexts, http3SkippedMode) } func testServerContexts(t *testing.T, mode testMode) { type baseKey struct{} type connKey struct{} @@ -6668,7 +6678,9 @@ func testUnsupportedTransferEncodingsReturn501(t *testing.T, mode testMode) { } // Issue 31753: don't sniff when Content-Encoding is set -func TestContentEncodingNoSniffing(t *testing.T) { run(t, testContentEncodingNoSniffing) } +func TestContentEncodingNoSniffing(t *testing.T) { + run(t, testContentEncodingNoSniffing, http3SkippedMode) +} func testContentEncodingNoSniffing(t *testing.T, mode testMode) { type setting struct { name string @@ -7111,6 +7123,7 @@ func testQuerySemicolon(t *testing.T, mode testMode, query string, wantX string, } } +// HTTP/3 trips off race detector. func TestMaxBytesHandler(t *testing.T) { // Not parallel: modifies the global rstAvoidanceDelay. defer afterTest(t) @@ -7121,7 +7134,7 @@ func TestMaxBytesHandler(t *testing.T) { func(t *testing.T) { run(t, func(t *testing.T, mode testMode) { testMaxBytesHandler(t, mode, maxSize, requestSize) - }, testNotParallel) + }, testNotParallel, http3SkippedMode) }) } } @@ -7248,7 +7261,7 @@ func TestProcessing(t *testing.T) { } } -func TestParseFormCleanup(t *testing.T) { run(t, testParseFormCleanup) } +func TestParseFormCleanup(t *testing.T) { run(t, testParseFormCleanup, http3SkippedMode) } func testParseFormCleanup(t *testing.T, mode testMode) { if mode == http2Mode { t.Skip("https://go.dev/issue/20253") @@ -7371,7 +7384,7 @@ func testHeadBody(t *testing.T, mode testMode, chunked bool, method string) { // TestDisableContentLength verifies that the Content-Length is set by default // or disabled when the header is set to nil. -func TestDisableContentLength(t *testing.T) { run(t, testDisableContentLength) } +func TestDisableContentLength(t *testing.T) { run(t, testDisableContentLength, http3SkippedMode) } func testDisableContentLength(t *testing.T, mode testMode) { noCL := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { w.Header()["Content-Length"] = nil // disable the default Content-Length response |
