From 69bf17ffbd67fdfbbfbdb09bf7e183ffcfc7811e Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 3 Sep 2015 14:27:53 -0700 Subject: [PATCH] Fixes 2 panics initialising tests Signed-off-by: John Howard --- integration-cli/docker_utils.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/integration-cli/docker_utils.go b/integration-cli/docker_utils.go index 0f6e5e926b..8ba8d12bdb 100644 --- a/integration-cli/docker_utils.go +++ b/integration-cli/docker_utils.go @@ -502,10 +502,9 @@ func init() { // Obtain the daemon platform so that it can be used by tests to make // intelligent decisions about how to configure themselves, and validate // that the target platform is valid. - res, b, err := sockRequestRaw("GET", "/version", nil, "application/json") - defer b.Close() - if err != nil || res.StatusCode != http.StatusOK { - panic("Init failed to get version: " + err.Error() + " " + string(res.StatusCode)) + res, _, err := sockRequestRaw("GET", "/version", nil, "application/json") + if err != nil || res == nil || (res != nil && res.StatusCode != http.StatusOK) { + panic(fmt.Errorf("Init failed to get version: %v. Res=%v", err.Error(), res)) } svrHeader, _ := httputils.ParseServerHeader(res.Header.Get("Server")) daemonPlatform = svrHeader.OS