Skip to content

Commit 5573885

Browse files
committed
net/http: remove TestTimeoutHandlerAndFlusher due to flakes
Removes TestTimeoutHandlerAndFlusher due to flakes on one of the builders due to timing issues. Perhaps later, we might need to bring it back when we've figured out the timing issues. Fixes #34573. Change-Id: Ia88d4da31fb228296144dc31f9a4288167fb4a53 Reviewed-on: https://go-review.googlesource.com/c/go/+/197757 Run-TryBot: Emmanuel Odeke <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 70a1efb commit 5573885

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

src/net/http/serve_test.go

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6161,54 +6161,6 @@ func TestUnsupportedTransferEncodingsReturn501(t *testing.T) {
61616161
}
61626162
}
61636163

6164-
// Issue 34439: ensure that TimeoutHandler doesn't implement Flusher
6165-
// and that any interaction with Flusher won't affect TimeoutHandler's behavior.
6166-
func TestTimeoutHandlerAndFlusher(t *testing.T) {
6167-
timeout := 50 * time.Millisecond
6168-
6169-
handler := HandlerFunc(func(w ResponseWriter, r *Request) {
6170-
w.WriteHeader(StatusTeapot)
6171-
w.Write([]byte("line1\n"))
6172-
fl, ok := w.(Flusher)
6173-
if ok {
6174-
fl.Flush()
6175-
}
6176-
time.Sleep(timeout * 2)
6177-
w.Write([]byte("line2\n"))
6178-
})
6179-
6180-
cst := httptest.NewUnstartedServer(TimeoutHandler(handler, timeout, "TIMED OUT\n"))
6181-
// Provide a logger that will report an error on any superfluous log.
6182-
cst.Config.ErrorLog = log.New(&errorOnWrite{t: t}, "", 0)
6183-
cst.Start()
6184-
defer cst.Close()
6185-
6186-
res, err := cst.Client().Get(cst.URL)
6187-
if err != nil {
6188-
t.Fatal(err)
6189-
}
6190-
defer res.Body.Close()
6191-
6192-
if g, w := res.StatusCode, StatusServiceUnavailable; g != w {
6193-
t.Errorf("Status code mismatch\ngot: %d\nwant: %d", g, w)
6194-
}
6195-
6196-
slurp, _ := ioutil.ReadAll(res.Body)
6197-
if g, w := string(slurp), "TIMED OUT\n"; g != w {
6198-
t.Fatalf("Body mismatch\ngot: %q\nwant: %q", g, w)
6199-
}
6200-
}
6201-
6202-
// errorOnWrite will invoke t.Error on any attempted write.
6203-
type errorOnWrite struct {
6204-
t *testing.T
6205-
}
6206-
6207-
func (ew *errorOnWrite) Write(b []byte) (int, error) {
6208-
ew.t.Errorf("Unexpected write: %s\n", b)
6209-
return len(b), nil
6210-
}
6211-
62126164
// fetchWireResponse is a helper for dialing to host,
62136165
// sending http1ReqBody as the payload and retrieving
62146166
// the response as it was sent on the wire.

0 commit comments

Comments
 (0)