Comment out calls to httptest.Server.Close() to work around

https://github.com/golang/go/issues/12262 . See #19254 for
more details. This change should be reverted when we upgrade
to Go 1.6.
This commit is contained in:
David Oppenheimer
2016-01-10 14:39:32 -08:00
parent 6f50699b93
commit 8ac484793d
50 changed files with 410 additions and 202 deletions

View File

@@ -704,7 +704,8 @@ func TestDoRequestNewWay(t *testing.T) {
T: t,
}
testServer := httptest.NewServer(&fakeHandler)
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
obj, err := c.Verb("POST").
Prefix("foo", "bar").
@@ -740,7 +741,8 @@ func TestBackoffLifecycle(t *testing.T) {
return
}
}))
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
// Test backoff recovery and increase. This correlates to the constants
@@ -776,7 +778,8 @@ func TestCheckRetryClosesBody(t *testing.T) {
w.Header().Set("Retry-After", "0")
w.WriteHeader(apierrors.StatusTooManyRequests)
}))
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
_, err := c.Verb("POST").
@@ -808,7 +811,8 @@ func TestCheckRetryHandles429And5xx(t *testing.T) {
w.WriteHeader([]int{apierrors.StatusTooManyRequests, 500, 501, 504}[count])
count++
}))
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
_, err := c.Verb("POST").
@@ -837,7 +841,8 @@ func BenchmarkCheckRetryClosesBody(b *testing.B) {
w.Header().Set("Retry-After", "0")
w.WriteHeader(apierrors.StatusTooManyRequests)
}))
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(b, testServer)
r := c.Verb("POST").
@@ -868,7 +873,8 @@ func TestDoRequestNewWayReader(t *testing.T) {
T: t,
}
testServer := httptest.NewServer(&fakeHandler)
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
obj, err := c.Verb("POST").
Resource("bar").
@@ -908,7 +914,8 @@ func TestDoRequestNewWayObj(t *testing.T) {
T: t,
}
testServer := httptest.NewServer(&fakeHandler)
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
obj, err := c.Verb("POST").
Suffix("baz").
@@ -963,7 +970,8 @@ func TestDoRequestNewWayFile(t *testing.T) {
T: t,
}
testServer := httptest.NewServer(&fakeHandler)
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
wasCreated := true
obj, err := c.Verb("POST").
@@ -1008,7 +1016,8 @@ func TestWasCreated(t *testing.T) {
T: t,
}
testServer := httptest.NewServer(&fakeHandler)
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
c := testRESTClient(t, testServer)
wasCreated := false
obj, err := c.Verb("PUT").
@@ -1177,7 +1186,8 @@ func TestWatch(t *testing.T) {
flusher.Flush()
}
}))
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
s := testRESTClient(t, testServer)
watching, err := s.Get().Prefix("path/to/watch/thing").Watch()
@@ -1217,7 +1227,8 @@ func TestStream(t *testing.T) {
w.Write([]byte(expectedBody))
flusher.Flush()
}))
defer testServer.Close()
// TODO: Uncomment when fix #19254
// defer testServer.Close()
s := testRESTClient(t, testServer)
readCloser, err := s.Get().Prefix("path/to/stream/thing").Stream()