summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 8e3b4254a..8887fd96e 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -593,3 +593,22 @@ func IsKernelNewThan(version string) (bool, error) {
return false, nil
}
+
+//Wait process or service inside container start, and ready to be used.
+func WaitContainerReady(p *PodmanTest, id string, expStr string, timeout int, step int) bool {
+ startTime := time.Now()
+ s := p.Podman([]string{"logs", id})
+ s.WaitWithDefaultTimeout()
+ fmt.Println(startTime)
+ for {
+ if time.Since(startTime) >= time.Duration(timeout)*time.Second {
+ return false
+ }
+ if strings.Contains(s.OutputToString(), expStr) {
+ return true
+ }
+ time.Sleep(time.Duration(step) * time.Second)
+ s = p.Podman([]string{"logs", id})
+ s.WaitWithDefaultTimeout()
+ }
+}