Browse code

Merge pull request #21337 from yongtang/21247-TestRunAttachFailedNoLeak

Flaky test: TestRunAttachFailedNoLeak (#21247)

Aaron Lehmann authored on 2016/04/13 09:40:16
Showing 1 changed files
... ...
@@ -4211,8 +4211,11 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
4211 4211
 	// Wait until container is fully up and running
4212 4212
 	c.Assert(waitRun("test"), check.IsNil)
4213 4213
 
4214
-	out, _, err := dockerCmdWithError("run", "-p", "8000:8000", "busybox", "true")
4215
-	c.Assert(err, checker.NotNil)
4214
+	out, _, err := dockerCmdWithError("run", "--name=fail", "-p", "8000:8000", "busybox", "true")
4215
+	// We will need the following `inspect` to diagnose the issue if test fails (#21247)
4216
+	out1, err1 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "test")
4217
+	out2, err2 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "fail")
4218
+	c.Assert(err, checker.NotNil, check.Commentf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
4216 4219
 	// check for windows error as well
4217 4220
 	// TODO Windows Post TP5. Fix the error message string
4218 4221
 	c.Assert(strings.Contains(string(out), "port is already allocated") ||