From 4280ed84fd7a8de329074f57bbfb3af6fc7f93d5 Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Mon, 14 Dec 2015 16:39:09 -0800 Subject: [PATCH] net/http: skip TestClientTimeout_Headers in HTTP/2 mode Change-Id: I3533b557cd6c7127ab4efbe8766184b51ce260c9 Reviewed-on: https://go-review.googlesource.com/17768 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick --- src/net/http/client_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go index 163534df388..3aa5b5d3ef7 100644 --- a/src/net/http/client_test.go +++ b/src/net/http/client_test.go @@ -1000,17 +1000,23 @@ func testClientTimeout(t *testing.T, h2 bool) { } } +func TestClientTimeout_Headers_h1(t *testing.T) { testClientTimeout_Headers(t, h1Mode) } +func TestClientTimeout_Headers_h2(t *testing.T) { + t.Skip("skipping in http2 mode; golang.org/issue/13540") + testClientTimeout_Headers(t, h2Mode) +} + // Client.Timeout firing before getting to the body -func TestClientTimeout_Headers(t *testing.T) { +func testClientTimeout_Headers(t *testing.T, h2 bool) { if testing.Short() { t.Skip("skipping in short mode") } defer afterTest(t) donec := make(chan bool) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { + cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) { <-donec })) - defer ts.Close() + defer cst.close() // Note that we use a channel send here and not a close. // The race detector doesn't know that we're waiting for a timeout // and thinks that the waitgroup inside httptest.Server is added to concurrently @@ -1020,9 +1026,8 @@ func TestClientTimeout_Headers(t *testing.T) { // doesn't know this, so synchronize explicitly. defer func() { donec <- true }() - c := &Client{Timeout: 500 * time.Millisecond} - - _, err := c.Get(ts.URL) + cst.c.Timeout = 500 * time.Millisecond + _, err := cst.c.Get(cst.ts.URL) if err == nil { t.Fatal("got response from Get; expected error") }