summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/common_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index c3a37236b..21afc4b84 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -530,6 +530,19 @@ func (p *PodmanTestIntegration) RunHealthCheck(cid string) error {
if hc.ExitCode() == 0 {
return nil
}
+ // Restart container if it's not running
+ ps := p.Podman([]string{"ps", "--no-trunc", "--q", "--filter", fmt.Sprintf("id=%s", cid)})
+ ps.WaitWithDefaultTimeout()
+ if ps.ExitCode() == 0 {
+ if !strings.Contains(ps.OutputToString(), cid) {
+ fmt.Printf("Container %s is not running, restarting", cid)
+ restart := p.Podman([]string{"restart", cid})
+ restart.WaitWithDefaultTimeout()
+ if restart.ExitCode() != 0 {
+ return errors.Errorf("unable to restart %s", cid)
+ }
+ }
+ }
fmt.Printf("Waiting for %s to pass healthcheck\n", cid)
time.Sleep(1 * time.Second)
}