From 875b8a6bdf1c2d4e7ac81cbce75b1d0f0c9f2fcf Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Wed, 6 Mar 2024 09:10:59 +0800 Subject: [PATCH] net/http: skip some test failed when httpmuxgo121=1 Signed-off-by: guoguangwu --- src/net/http/request_test.go | 4 ++++ src/net/http/server_test.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/net/http/request_test.go b/src/net/http/request_test.go index 6ce32332e75..380a433a11a 100644 --- a/src/net/http/request_test.go +++ b/src/net/http/request_test.go @@ -12,6 +12,7 @@ import ( "encoding/base64" "errors" "fmt" + "internal/godebug" "io" "math" "mime/multipart" @@ -1535,6 +1536,9 @@ func TestSetPathValue(t *testing.T) { } func TestStatus(t *testing.T) { + if godebug.New("httpmuxgo121").Value() == "1" { + t.Skip("skipping test in TestStatus when httpmuxgo121=1") + } // The main purpose of this test is to check 405 responses and the Allow header. h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) mux := NewServeMux() diff --git a/src/net/http/server_test.go b/src/net/http/server_test.go index f4aafc853bd..faa71bb23e6 100644 --- a/src/net/http/server_test.go +++ b/src/net/http/server_test.go @@ -8,6 +8,7 @@ package http import ( "fmt" + "internal/godebug" "net/url" "regexp" "testing" @@ -71,6 +72,9 @@ type handler struct{ i int } func (handler) ServeHTTP(ResponseWriter, *Request) {} func TestFindHandler(t *testing.T) { + if godebug.New("httpmuxgo121").Value() == "1" { + t.Skip("skipping test in TestFindHandler when httpmuxgo121=1") + } mux := NewServeMux() for _, ph := range []struct { pat string @@ -133,6 +137,9 @@ func TestEmptyServeMux(t *testing.T) { } func TestRegisterErr(t *testing.T) { + if godebug.New("httpmuxgo121").Value() == "1" { + t.Skip("skipping test in TestRegisterErr when httpmuxgo121=1") + } mux := NewServeMux() h := &handler{} mux.Handle("/a", h)