diff --git a/components/cli/vendor/github.com/docker/docker/client/hijack.go b/components/cli/vendor/github.com/docker/docker/client/hijack.go index 346c74ae829..8cf0119f3dd 100644 --- a/components/cli/vendor/github.com/docker/docker/client/hijack.go +++ b/components/cli/vendor/github.com/docker/docker/client/hijack.go @@ -177,12 +177,14 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (net.Conn, e // Server hijacks the connection, error 'connection closed' expected resp, err := clientconn.Do(req) - if err != nil { - return nil, err - } - if resp.StatusCode != http.StatusSwitchingProtocols { - resp.Body.Close() - return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) + if err != httputil.ErrPersistEOF { + if err != nil { + return nil, err + } + if resp.StatusCode != http.StatusSwitchingProtocols { + resp.Body.Close() + return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) + } } c, br := clientconn.Hijack() diff --git a/components/engine/client/hijack.go b/components/engine/client/hijack.go index 346c74ae829..8cf0119f3dd 100644 --- a/components/engine/client/hijack.go +++ b/components/engine/client/hijack.go @@ -177,12 +177,14 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (net.Conn, e // Server hijacks the connection, error 'connection closed' expected resp, err := clientconn.Do(req) - if err != nil { - return nil, err - } - if resp.StatusCode != http.StatusSwitchingProtocols { - resp.Body.Close() - return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) + if err != httputil.ErrPersistEOF { + if err != nil { + return nil, err + } + if resp.StatusCode != http.StatusSwitchingProtocols { + resp.Body.Close() + return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) + } } c, br := clientconn.Hijack() diff --git a/components/engine/integration-cli/docker_cli_rmi_test.go b/components/engine/integration-cli/docker_cli_rmi_test.go index afbc4c2fab0..01d526eb802 100644 --- a/components/engine/integration-cli/docker_cli_rmi_test.go +++ b/components/engine/integration-cli/docker_cli_rmi_test.go @@ -150,8 +150,8 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c dockerCmd(c, "tag", imgID, newTag) runSleepingContainerInImage(c, imgID) - out, _, err := dockerCmdWithError("rmi", "-f", imgID) - // rmi -f should not delete image with running containers + out, _, err := dockerCmdWithError("rmi", imgID) + // rmi should not delete image with running containers c.Assert(err, checker.NotNil) c.Assert(out, checker.Contains, "(cannot be forced) - image is being used by running container") } @@ -243,7 +243,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) { dockerCmd(c, "rmi", "-f", imageIds[1]) // Try to remove the image of the running container and see if it fails as expected. - out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0]) + out, _, err := dockerCmdWithError("rmi", imageIds[0]) // The image of the running container should not be removed. c.Assert(err, checker.NotNil) c.Assert(out, checker.Contains, "image is being used by running container", check.Commentf("out: %s", out)) diff --git a/components/engine/integration-cli/docker_cli_run_unix_test.go b/components/engine/integration-cli/docker_cli_run_unix_test.go index b3d1b07218d..66fa40c608e 100644 --- a/components/engine/integration-cli/docker_cli_run_unix_test.go +++ b/components/engine/integration-cli/docker_cli_run_unix_test.go @@ -1564,7 +1564,7 @@ func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) { c.Assert(strings.TrimSpace(out), checker.Equals, "50000\n100000") out = inspectField(c, "test", "HostConfig.NanoCpus") - c.Assert(out, checker.Equals, "5e+08", check.Commentf("setting the Nano CPUs failed")) + c.Assert(out, checker.Equals, "500000000", check.Commentf("setting the Nano CPUs failed")) out = inspectField(c, "test", "HostConfig.CpuQuota") c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS quota should be 0")) out = inspectField(c, "test", "HostConfig.CpuPeriod") diff --git a/components/engine/integration-cli/docker_cli_service_logs_test.go b/components/engine/integration-cli/docker_cli_service_logs_test.go index d2ce36def06..43086a7c915 100644 --- a/components/engine/integration-cli/docker_cli_service_logs_test.go +++ b/components/engine/integration-cli/docker_cli_service_logs_test.go @@ -40,7 +40,7 @@ func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) { // make sure task has been deployed. waitAndAssert(c, defaultReconciliationTimeout, d.CheckRunningTaskImages, checker.DeepEquals, - map[string]int{"busybox": len(services)}) + map[string]int{"busybox:latest": len(services)}) for name, message := range services { out, err := d.Cmd("service", "logs", name) diff --git a/components/engine/integration-cli/docker_cli_swarm_test.go b/components/engine/integration-cli/docker_cli_swarm_test.go index a0bb7a22834..ab3687c5f79 100644 --- a/components/engine/integration-cli/docker_cli_swarm_test.go +++ b/components/engine/integration-cli/docker_cli_swarm_test.go @@ -1730,18 +1730,13 @@ func (s *DockerSwarmSuite) TestSwarmServicePsMultipleServiceIDs(c *check.C) { // Name Prefix out, err = d.Cmd("service", "ps", "to") - c.Assert(err, checker.IsNil) - c.Assert(out, checker.Contains, name1+".1") - c.Assert(out, checker.Contains, name1+".2") - c.Assert(out, checker.Contains, name1+".3") - c.Assert(out, checker.Contains, name2+".1") - c.Assert(out, checker.Contains, name2+".2") - c.Assert(out, checker.Contains, name2+".3") + c.Assert(err, checker.NotNil) + c.Assert(out, checker.Contains, "no such service: to") // Name Prefix (no hit) out, err = d.Cmd("service", "ps", "noname") c.Assert(err, checker.NotNil) - c.Assert(out, checker.Contains, "no such services: noname") + c.Assert(out, checker.Contains, "no such service: noname") out, err = d.Cmd("service", "ps", id1) c.Assert(err, checker.IsNil) diff --git a/components/engine/integration-cli/docker_cli_swarm_unix_test.go b/components/engine/integration-cli/docker_cli_swarm_unix_test.go index cffabcc2afd..91ddd5f0498 100644 --- a/components/engine/integration-cli/docker_cli_swarm_unix_test.go +++ b/components/engine/integration-cli/docker_cli_swarm_unix_test.go @@ -94,7 +94,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *check.C) { time.Sleep(20 * time.Second) - image := "busybox" + image := "busybox:latest" // create a new global service again. _, err = d1.Cmd("service", "create", "--no-resolve-image", "--name", serviceName, "--mode=global", "--network", networkName, image, "top") c.Assert(err, checker.IsNil) diff --git a/components/engine/integration-cli/docker_cli_update_unix_test.go b/components/engine/integration-cli/docker_cli_update_unix_test.go index be2274bb39a..b699f0d94be 100644 --- a/components/engine/integration-cli/docker_cli_update_unix_test.go +++ b/components/engine/integration-cli/docker_cli_update_unix_test.go @@ -296,7 +296,7 @@ func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) { c.Assert(strings.TrimSpace(out), checker.Equals, "50000\n100000") out = inspectField(c, "top", "HostConfig.NanoCpus") - c.Assert(out, checker.Equals, "5e+08", check.Commentf("setting the Nano CPUs failed")) + c.Assert(out, checker.Equals, "500000000", check.Commentf("setting the Nano CPUs failed")) out = inspectField(c, "top", "HostConfig.CpuQuota") c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS quota should be 0")) out = inspectField(c, "top", "HostConfig.CpuPeriod") @@ -308,7 +308,7 @@ func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) { out, _ = dockerCmd(c, "update", "--cpus", "0.8", "top") out = inspectField(c, "top", "HostConfig.NanoCpus") - c.Assert(out, checker.Equals, "8e+08", check.Commentf("updating the Nano CPUs failed")) + c.Assert(out, checker.Equals, "800000000", check.Commentf("updating the Nano CPUs failed")) out = inspectField(c, "top", "HostConfig.CpuQuota") c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS quota should be 0")) out = inspectField(c, "top", "HostConfig.CpuPeriod")