From e91947e4a5d1f789d70d7633c7b7c503df65b3f2 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Thu, 25 Feb 2021 17:37:09 +0100 Subject: [PATCH 1/2] ACI workaround invocation does not return, but container is actually running OK, trying to not block on this. Signed-off-by: Guillaume Tardif --- aci/e2e/e2e-aci_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/aci/e2e/e2e-aci_test.go b/aci/e2e/e2e-aci_test.go index 87c0ce094..c3cf42723 100644 --- a/aci/e2e/e2e-aci_test.go +++ b/aci/e2e/e2e-aci_test.go @@ -485,10 +485,14 @@ func TestContainerRunAttached(t *testing.T) { time.Sleep(1 * time.Second) c.RunDockerCmd("rm", "-f", container) } - c.RunDockerCmd("run", - "--name", "fallback", // don't reuse the container name, this container is in a weird state and blocks everything - "--memory", "0.1G", "--cpus", "0.1", - "nginx") + go func() { // this specific call to run sometimes does not come back when in this weird state, but the container is actually running fine + c.RunDockerCmd("run", + "--name", container, // don't reuse the container name, this container is in a weird state and blocks everything + "--memory", "0.1G", "--cpus", "0.1", + "nginx") + fmt.Printf(" [%s] Finished docker run %s\n", t.Name(), container) + }() + waitForStatus(t, c, container, convert.StatusRunning) } else { res.Assert(t, icmd.Expected{Out: container}) waitForStatus(t, c, container, convert.StatusRunning) From 8f2af3011af1f25f1ef75240cc62ff2fe0d95ec0 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 26 Feb 2021 09:51:10 +0100 Subject: [PATCH 2/2] continue waiting if expected container not yet ready for inspect Signed-off-by: Guillaume Tardif --- aci/e2e/e2e-aci_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aci/e2e/e2e-aci_test.go b/aci/e2e/e2e-aci_test.go index c3cf42723..71ac5548c 100644 --- a/aci/e2e/e2e-aci_test.go +++ b/aci/e2e/e2e-aci_test.go @@ -977,7 +977,10 @@ func getContainerName(stdout string) string { func waitForStatus(t *testing.T, c *E2eCLI, containerID string, statuses ...string) { checkStopped := func(logt poll.LogT) poll.Result { - res := c.RunDockerCmd("inspect", containerID) + res := c.RunDockerOrExitError("inspect", containerID) + if res.Error != nil { + return poll.Continue("Error while inspecting container %s: %s", containerID, res.Combined()) + } containerInspect, err := parseContainerInspect(res.Stdout()) assert.NilError(t, err) for _, status := range statuses {