diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-04-17 03:41:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-17 03:41:56 -0400 |
commit | 18b9f2bd10206e9b4053c9f1a736abe2866ba274 (patch) | |
tree | 3d133346abe597bdfe4767b71a093310a20b434d /test/e2e/libpod_suite_test.go | |
parent | 63facbec150662c4b418a12237ca850a37321148 (diff) | |
parent | f1a4867bcd4db4e5299225c0e7a35451ec0de7db (diff) | |
download | podman-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.go | 29 |
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 +} |