diff options
Diffstat (limited to 'runsc/test/testutil')
-rw-r--r-- | runsc/test/testutil/testutil.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runsc/test/testutil/testutil.go b/runsc/test/testutil/testutil.go index 1b5a02c0f..fd558e2d5 100644 --- a/runsc/test/testutil/testutil.go +++ b/runsc/test/testutil/testutil.go @@ -230,8 +230,12 @@ func Poll(cb func() error, timeout time.Duration) error { // WaitForHTTP tries GET requests on a port until the call succeeds or timeout. func WaitForHTTP(port int, timeout time.Duration) error { cb := func() error { - _, err := http.Get(fmt.Sprintf("http://localhost:%d/", port)) - return err + resp, err := http.Get(fmt.Sprintf("http://localhost:%d/", port)) + if err != nil { + return err + } + resp.Body.Close() + return nil } return Poll(cb, timeout) } |