Updated ACI e2e flaky test to avoid failing when https://github.com/docker/desktop-microsoft/issues/49 happens
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
87cee4d1e5
commit
6ad48b9212
|
|
@ -394,7 +394,7 @@ func TestContainerRunAttached(t *testing.T) {
|
||||||
t.Run("rm stopped container", func(t *testing.T) {
|
t.Run("rm stopped container", func(t *testing.T) {
|
||||||
res := c.RunDockerCmd("stop", container)
|
res := c.RunDockerCmd("stop", container)
|
||||||
res.Assert(t, icmd.Expected{Out: container})
|
res.Assert(t, icmd.Expected{Out: container})
|
||||||
waitForStatus(t, c, container, "Terminated")
|
waitForStatus(t, c, container, "Terminated", "Node Stopped")
|
||||||
|
|
||||||
res = c.RunDockerCmd("rm", container)
|
res = c.RunDockerCmd("rm", container)
|
||||||
res.Assert(t, icmd.Expected{Out: container})
|
res.Assert(t, icmd.Expected{Out: container})
|
||||||
|
|
@ -664,15 +664,17 @@ func getContainerName(stdout string) string {
|
||||||
return strings.TrimSpace(out[len(out)-1])
|
return strings.TrimSpace(out[len(out)-1])
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForStatus(t *testing.T, c *E2eCLI, containerID string, status string) {
|
func waitForStatus(t *testing.T, c *E2eCLI, containerID string, statuses ...string) {
|
||||||
checkStopped := func(logt poll.LogT) poll.Result {
|
checkStopped := func(logt poll.LogT) poll.Result {
|
||||||
res := c.RunDockerCmd("inspect", containerID)
|
res := c.RunDockerCmd("inspect", containerID)
|
||||||
containerInspect, err := ParseContainerInspect(res.Stdout())
|
containerInspect, err := ParseContainerInspect(res.Stdout())
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
for _, status := range statuses {
|
||||||
if containerInspect.Status == status {
|
if containerInspect.Status == status {
|
||||||
return poll.Success()
|
return poll.Success()
|
||||||
}
|
}
|
||||||
return poll.Continue("Status %s != %s (expected) for container %s", containerInspect.Status, status, containerID)
|
}
|
||||||
|
return poll.Continue("Status %s != %s (expected) for container %s", containerInspect.Status, statuses, containerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
poll.WaitOn(t, checkStopped, poll.WithDelay(5*time.Second), poll.WithTimeout(90*time.Second))
|
poll.WaitOn(t, checkStopped, poll.WithDelay(5*time.Second), poll.WithTimeout(90*time.Second))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue