summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-09 15:58:50 +0200
committerGitHub <noreply@github.com>2019-07-09 15:58:50 +0200
commit2843d0dc8626f4c3019e34eba4772fd6120e9e8d (patch)
treec093520f5c50fb41070ef954a0d64a48b276de0b /test
parenteb4b7ed12bd831ac14cc6a6eea542d61900cb159 (diff)
parent1322dbc24f4f7aa46ede8e981d69076663db5f43 (diff)
downloadpodman-2843d0dc8626f4c3019e34eba4772fd6120e9e8d.tar.gz
podman-2843d0dc8626f4c3019e34eba4772fd6120e9e8d.tar.bz2
podman-2843d0dc8626f4c3019e34eba4772fd6120e9e8d.zip
Merge pull request #3480 from mheon/potential_ps_test_fix
Restart failed containers in tests
Diffstat (limited to 'test')
-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)
}