"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>
| ... | ... |
@@ -225,22 +225,15 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
|
| 225 | 225 |
|
| 226 | 226 |
id1 := strings.TrimSpace(string(out1)) |
| 227 | 227 |
id2 := strings.TrimSpace(string(out2)) |
| 228 |
- err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", 30*time.Second)
|
|
| 228 |
+ waitTimeout := 15 * time.Second |
|
| 229 |
+ if daemonPlatform == "windows" {
|
|
| 230 |
+ waitTimeout = 150 * time.Second |
|
| 231 |
+ } |
|
| 232 |
+ err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)
|
|
| 229 | 233 |
c.Assert(err, checker.IsNil) |
| 230 | 234 |
|
| 231 |
- // TODO: fix racey problem during restart: |
|
| 232 |
- // https://jenkins.dockerproject.org/job/Docker-PRs-Win2Lin/24665/console |
|
| 233 |
- // Error response from daemon: Cannot restart container 6655f620d90b390527db23c0a15b3e46d86a58ecec20a5697ab228d860174251: remove /var/run/docker/libcontainerd/6655f620d90b390527db23c0a15b3e46d86a58ecec20a5697ab228d860174251/rootfs: device or resource busy |
|
| 234 |
- if _, _, err := dockerCmdWithError("restart", id1); err != nil {
|
|
| 235 |
- // if restart met racey problem, try again |
|
| 236 |
- time.Sleep(500 * time.Millisecond) |
|
| 237 |
- dockerCmd(c, "restart", id1) |
|
| 238 |
- } |
|
| 239 |
- if _, _, err := dockerCmdWithError("restart", id2); err != nil {
|
|
| 240 |
- // if restart met racey problem, try again |
|
| 241 |
- time.Sleep(500 * time.Millisecond) |
|
| 242 |
- dockerCmd(c, "restart", id2) |
|
| 243 |
- } |
|
| 235 |
+ dockerCmd(c, "restart", id1) |
|
| 236 |
+ dockerCmd(c, "restart", id2) |
|
| 244 | 237 |
|
| 245 | 238 |
dockerCmd(c, "stop", id1) |
| 246 | 239 |
dockerCmd(c, "stop", id2) |