Commit 388d5330 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

net/http/httptest: add test for issue 7264

The test fails now with -race, so it's disabled.
The intention is that the fix for issue 7264
will also modify this test the same way and enable it.
Reporduce with 'go test -race -issue7264 -cpu=4'.
Update #7264

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/86770043
parent 3ca788de
......@@ -5,9 +5,11 @@
package httptest
import (
"flag"
"io/ioutil"
"net/http"
"testing"
"time"
)
func TestServer(t *testing.T) {
......@@ -27,3 +29,26 @@ func TestServer(t *testing.T) {
t.Errorf("got %q, want hello", string(got))
}
}
var testIssue7264 = flag.Bool("issue7264", false, "enable failing test for issue 7264")
func TestIssue7264(t *testing.T) {
if !*testIssue7264 {
t.Skip("skipping failing test for issue 7264")
}
for i := 0; i < 1000; i++ {
func() {
ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
defer ts.Close()
tr := &http.Transport{
ResponseHeaderTimeout: time.Nanosecond,
}
defer tr.CloseIdleConnections()
c := &http.Client{Transport: tr}
res, err := c.Get(ts.URL)
if err == nil {
res.Body.Close()
}
}()
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment