From 9077c8968950133fdfac9898a20f9887f8df78f2 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Mon, 28 Sep 2015 22:09:04 -0400 Subject: [PATCH] Make sure test container is running before exec Fixes race in TestExecStartFails Signed-off-by: Brian Goff --- integration-cli/docker_cli_exec_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/integration-cli/docker_cli_exec_test.go b/integration-cli/docker_cli_exec_test.go index d1de709805..f6d1c7eb6e 100644 --- a/integration-cli/docker_cli_exec_test.go +++ b/integration-cli/docker_cli_exec_test.go @@ -15,6 +15,7 @@ import ( "sync" "time" + "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" ) @@ -616,9 +617,9 @@ func (s *DockerSuite) TestExecStartFails(c *check.C) { testRequires(c, DaemonIsLinux) name := "exec-15750" dockerCmd(c, "run", "-d", "--name", name, "busybox", "top") + c.Assert(waitRun(name), check.IsNil) - _, errmsg, status := dockerCmdWithStdoutStderr(nil, "exec", name, "no-such-cmd") - if status == 255 && !strings.Contains(errmsg, "executable file not found") { - c.Fatal("exec error message not received. The daemon might had crashed") - } + out, _, err := dockerCmdWithError("exec", name, "no-such-cmd") + c.Assert(err, check.NotNil, check.Commentf(out)) + c.Assert(out, checker.Contains, "executable file not found") }