summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-06-02 09:18:24 -0500
committerbaude <bbaude@redhat.com>2019-06-03 11:06:46 -0500
commitc727cd1dc6fd83e9bc40865e2acab0d6966bb3ce (patch)
tree22fe815a547b3e105e68b5150a23f2b3598c78c2 /test
parent176a41c355bdc567978f4417e5bd2d3c7cdce914 (diff)
downloadpodman-c727cd1dc6fd83e9bc40865e2acab0d6966bb3ce.tar.gz
podman-c727cd1dc6fd83e9bc40865e2acab0d6966bb3ce.tar.bz2
podman-c727cd1dc6fd83e9bc40865e2acab0d6966bb3ce.zip
fix timing issues with some tests
some integration tests are inherently problematic due to timing issues. one such case is running a valid health check on container that runs nginx. while the container may be running, nginx may not have finished executing itself and therefore the healthcheck fails. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/healthcheck_run_test.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index be54cf1bd..2af427d28 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -5,6 +5,7 @@ package integration
import (
"fmt"
"os"
+ "time"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -47,9 +48,19 @@ var _ = Describe("Podman healthcheck run", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
- hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(0))
+ exitCode := 999
+
+ // Buy a little time to get container running
+ for i := 0; i < 5; i++ {
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ exitCode = hc.ExitCode()
+ if exitCode == 0 || i == 4 {
+ break
+ }
+ time.Sleep(1 * time.Second)
+ }
+ Expect(exitCode).To(Equal(0))
})
It("podman healthcheck that should fail", func() {