Uncomment the code that cause by #19254

This commit is contained in:
zhouhaibing089
2016-04-21 04:50:55 -07:00
committed by haibzhou
parent c0020aff59
commit bf1a3f99c0
53 changed files with 218 additions and 436 deletions

View File

@@ -205,8 +205,7 @@ func TestFileServing(t *testing.T) {
const prefix = "/foo/"
handler := newFileHandler(prefix, dir)
server := httptest.NewServer(handler)
// TODO: Uncomment when fix #19254
// defer server.Close()
defer server.Close()
url := server.URL + prefix + fname
res, err := http.Get(url)
@@ -236,8 +235,7 @@ func TestAPIRequests(t *testing.T) {
}
fmt.Fprintf(w, "%s %s %s", r.Method, r.RequestURI, string(b))
}))
// TODO: Uncomment when fix #19254
// defer ts.Close()
defer ts.Close()
// httptest.NewServer should always generate a valid URL.
target, _ := url.Parse(ts.URL)
@@ -273,8 +271,7 @@ func TestPathHandling(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, r.URL.Path)
}))
// TODO: Uncomment when fix #19254
// defer ts.Close()
defer ts.Close()
table := []struct {
prefix string
@@ -304,8 +301,7 @@ func TestPathHandling(t *testing.T) {
t.Fatalf("%#v: %v", item, err)
}
pts := httptest.NewServer(p.handler)
// TODO: Uncomment when fix #19254
// defer pts.Close()
defer pts.Close()
r, err := http.Get(pts.URL + item.reqPath)
if err != nil {