summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-05-25 06:15:32 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-05-25 09:25:38 -0400
commit9ab3fd876d832ffe881862818dea867d9e06cbe6 (patch)
tree146b906d990d1ab02475535a60d1052a86555228 /test/e2e
parenta6f0ac229f57c1ac93fe0604dd923f704e976d9a (diff)
downloadpodman-9ab3fd876d832ffe881862818dea867d9e06cbe6.tar.gz
podman-9ab3fd876d832ffe881862818dea867d9e06cbe6.tar.bz2
podman-9ab3fd876d832ffe881862818dea867d9e06cbe6.zip
Fix race condition in running ls container in a pod
All of the tests has an assumption that RunLsContainer and RunLsContainerInPod completes the container before returning. But since the container is running in back ground mode, the container could be still running before tools attempt to remove it. Removing the "-d" from the command fixes the container to match the assumption. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/common_test.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 359345096..7ffee961c 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -408,7 +408,14 @@ func (p *PodmanTestIntegration) RunLsContainer(name string) (*PodmanSessionInteg
podmanArgs = append(podmanArgs, "-d", ALPINE, "ls")
session := p.Podman(podmanArgs)
session.WaitWithDefaultTimeout()
- return session, session.ExitCode(), session.OutputToString()
+ if session.ExitCode() != 0 {
+ return session, session.ExitCode(), session.OutputToString()
+ }
+ cid := session.OutputToString()
+
+ wsession := p.Podman([]string{"wait", cid})
+ wsession.WaitWithDefaultTimeout()
+ return session, wsession.ExitCode(), cid
}
// RunNginxWithHealthCheck runs the alpine nginx container with an optional name and adds a healthcheck into it
@@ -431,7 +438,14 @@ func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSe
podmanArgs = append(podmanArgs, "-d", ALPINE, "ls")
session := p.Podman(podmanArgs)
session.WaitWithDefaultTimeout()
- return session, session.ExitCode(), session.OutputToString()
+ if session.ExitCode() != 0 {
+ return session, session.ExitCode(), session.OutputToString()
+ }
+ cid := session.OutputToString()
+
+ wsession := p.Podman([]string{"wait", cid})
+ wsession.WaitWithDefaultTimeout()
+ return session, wsession.ExitCode(), cid
}
// BuildImage uses podman build and buildah to build an image