]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.13] net/http: remove TestTimeoutHandlerAndFlusher due to flakes
authorEmmanuel T Odeke <emmanuel@orijtech.com>
Fri, 27 Sep 2019 15:21:27 +0000 (08:21 -0700)
committerBryan C. Mills <bcmills@google.com>
Fri, 27 Sep 2019 17:27:02 +0000 (17:27 +0000)
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.

Updates #34573
Fixes #34579

Change-Id: Ia88d4da31fb228296144dc31f9a4288167fb4a53
Reviewed-on: https://go-review.googlesource.com/c/go/+/197757
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 55738850c43bd1ae46326f7419dbd8f49808c776)
Reviewed-on: https://go-review.googlesource.com/c/go/+/197719
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
src/net/http/serve_test.go

index e86cc9bdd21037c246b3c102a079aa66c9eda5b2..1d1449aa659ef417db74d94a17b1d9c5f13a61b9 100644 (file)
@@ -6161,54 +6161,6 @@ func TestUnsupportedTransferEncodingsReturn501(t *testing.T) {
        }
 }
 
-// Issue 34439: ensure that TimeoutHandler doesn't implement Flusher
-// and that any interaction with Flusher won't affect TimeoutHandler's behavior.
-func TestTimeoutHandlerAndFlusher(t *testing.T) {
-       timeout := 50 * time.Millisecond
-
-       handler := HandlerFunc(func(w ResponseWriter, r *Request) {
-               w.WriteHeader(StatusTeapot)
-               w.Write([]byte("line1\n"))
-               fl, ok := w.(Flusher)
-               if ok {
-                       fl.Flush()
-               }
-               time.Sleep(timeout * 2)
-               w.Write([]byte("line2\n"))
-       })
-
-       cst := httptest.NewUnstartedServer(TimeoutHandler(handler, timeout, "TIMED OUT\n"))
-       // Provide a logger that will report an error on any superfluous log.
-       cst.Config.ErrorLog = log.New(&errorOnWrite{t: t}, "", 0)
-       cst.Start()
-       defer cst.Close()
-
-       res, err := cst.Client().Get(cst.URL)
-       if err != nil {
-               t.Fatal(err)
-       }
-       defer res.Body.Close()
-
-       if g, w := res.StatusCode, StatusServiceUnavailable; g != w {
-               t.Errorf("Status code mismatch\ngot:  %d\nwant: %d", g, w)
-       }
-
-       slurp, _ := ioutil.ReadAll(res.Body)
-       if g, w := string(slurp), "TIMED OUT\n"; g != w {
-               t.Fatalf("Body mismatch\ngot:  %q\nwant: %q", g, w)
-       }
-}
-
-// errorOnWrite will invoke t.Error on any attempted write.
-type errorOnWrite struct {
-       t *testing.T
-}
-
-func (ew *errorOnWrite) Write(b []byte) (int, error) {
-       ew.t.Errorf("Unexpected write: %s\n", b)
-       return len(b), nil
-}
-
 // fetchWireResponse is a helper for dialing to host,
 // sending http1ReqBody as the payload and retrieving
 // the response as it was sent on the wire.