From e857785df4b53df551ad25d132bc0274923f2e53 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Tue, 13 Dec 2016 12:04:53 +0100 Subject: [PATCH] Fixing win2lin builds by adding a testRequires to DockerDaemonSuite The success of the win2lin CI before was really "by chance" on the DockerDaemonSuite : the DockerDaemonSuite was panicking when starting the daemon on the first non-skipped test.The suite panicked but as the error returned from `StartWithBusybox` was nil, the test kept going and was OK because the client had all the correct environment variables set up to discuss with the remote daemon. Then, as the suite panicked, no more test attached on the DockerDaemonSuite ran (that's why on win2lin, `DockerDaemonSuite` was only composed by 5 tests !). The really bad thing is, we didn't get any report of the panic on the suite (go-check hiding something somewhere). As DockerDaemonSuite needs to run test on the same host as it's running, this adds a `SameHostDaemon` requirement to the Suite. This changes also make sure `TestRestartContainerWithRestartPolicy` does left weirdies behind it. Signed-off-by: Vincent Demeester --- integration-cli/check_test.go | 4 ++-- integration-cli/daemon/daemon.go | 1 - integration-cli/docker_cli_restart_test.go | 9 +++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/integration-cli/check_test.go b/integration-cli/check_test.go index 47ea94e34a..1d6179f7f3 100644 --- a/integration-cli/check_test.go +++ b/integration-cli/check_test.go @@ -217,14 +217,14 @@ func (s *DockerDaemonSuite) OnTimeout(c *check.C) { } func (s *DockerDaemonSuite) SetUpTest(c *check.C) { - testRequires(c, DaemonIsLinux) + testRequires(c, DaemonIsLinux, SameHostDaemon) s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{ Experimental: experimentalDaemon, }) } func (s *DockerDaemonSuite) TearDownTest(c *check.C) { - testRequires(c, DaemonIsLinux) + testRequires(c, DaemonIsLinux, SameHostDaemon) if s.d != nil { s.d.Stop(c) } diff --git a/integration-cli/daemon/daemon.go b/integration-cli/daemon/daemon.go index 2ae37bfcf3..41a25ab197 100644 --- a/integration-cli/daemon/daemon.go +++ b/integration-cli/daemon/daemon.go @@ -195,7 +195,6 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error { if err != nil { return errors.Wrapf(err, "[%s] could not find docker binary in $PATH", d.id) } - args := append(d.GlobalFlags, "--containerd", "/var/run/docker/libcontainerd/docker-containerd.sock", "--graph", d.Root, diff --git a/integration-cli/docker_cli_restart_test.go b/integration-cli/docker_cli_restart_test.go index cf196e40f4..f6dda6d75c 100644 --- a/integration-cli/docker_cli_restart_test.go +++ b/integration-cli/docker_cli_restart_test.go @@ -259,10 +259,19 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) { dockerCmd(c, "restart", id1) dockerCmd(c, "restart", id2) + // Make sure we can stop/start (regression test from a705e166cf3bcca62543150c2b3f9bfeae45ecfa) dockerCmd(c, "stop", id1) dockerCmd(c, "stop", id2) dockerCmd(c, "start", id1) dockerCmd(c, "start", id2) + + // Kill the containers, making sure the are stopped at the end of the test + dockerCmd(c, "kill", id1) + dockerCmd(c, "kill", id2) + err = waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout) + c.Assert(err, checker.IsNil) + err = waitInspect(id2, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout) + c.Assert(err, checker.IsNil) } func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {