mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix test case
"TestRestartContainerwithRestartPolicy" contains some codes that could be flaky, it's supposed to be fixed in #22256. This commit removes unnecessary code, make the test case cleaner. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
parent
1e9b2355e4
commit
a7eecd2b61
1 changed files with 7 additions and 14 deletions
|
@ -225,22 +225,15 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
|
|||
|
||||
id1 := strings.TrimSpace(string(out1))
|
||||
id2 := strings.TrimSpace(string(out2))
|
||||
err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", 30*time.Second)
|
||||
waitTimeout := 15 * time.Second
|
||||
if daemonPlatform == "windows" {
|
||||
waitTimeout = 150 * time.Second
|
||||
}
|
||||
err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// TODO: fix racey problem during restart:
|
||||
// https://jenkins.dockerproject.org/job/Docker-PRs-Win2Lin/24665/console
|
||||
// Error response from daemon: Cannot restart container 6655f620d90b390527db23c0a15b3e46d86a58ecec20a5697ab228d860174251: remove /var/run/docker/libcontainerd/6655f620d90b390527db23c0a15b3e46d86a58ecec20a5697ab228d860174251/rootfs: device or resource busy
|
||||
if _, _, err := dockerCmdWithError("restart", id1); err != nil {
|
||||
// if restart met racey problem, try again
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
dockerCmd(c, "restart", id1)
|
||||
}
|
||||
if _, _, err := dockerCmdWithError("restart", id2); err != nil {
|
||||
// if restart met racey problem, try again
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
dockerCmd(c, "restart", id2)
|
||||
}
|
||||
dockerCmd(c, "restart", id1)
|
||||
dockerCmd(c, "restart", id2)
|
||||
|
||||
dockerCmd(c, "stop", id1)
|
||||
dockerCmd(c, "stop", id2)
|
||||
|
|
Loading…
Reference in a new issue