summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-04-17 03:41:56 -0400
committerGitHub <noreply@github.com>2018-04-17 03:41:56 -0400
commit18b9f2bd10206e9b4053c9f1a736abe2866ba274 (patch)
tree3d133346abe597bdfe4767b71a093310a20b434d /test/e2e/libpod_suite_test.go
parent63facbec150662c4b418a12237ca850a37321148 (diff)
parentf1a4867bcd4db4e5299225c0e7a35451ec0de7db (diff)
downloadpodman-18b9f2bd10206e9b4053c9f1a736abe2866ba274.tar.gz
podman-18b9f2bd10206e9b4053c9f1a736abe2866ba274.tar.bz2
podman-18b9f2bd10206e9b4053c9f1a736abe2866ba274.zip
Merge pull request #566 from ypu/push_test
Add several podman push tests
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 8e3b4254a..fa48334a3 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -593,3 +593,32 @@ 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()
+ }
+}
+
+//IsCommandAvaible check if command exist
+func IsCommandAvailable(command string) bool {
+ check := exec.Command("bash", "-c", strings.Join([]string{"command -v", command}, " "))
+ err := check.Run()
+ if err != nil {
+ return false
+ }
+ return true
+}