summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
authorYiqiao Pu <ypu@redhat.com>2018-04-11 15:04:25 +0800
committerYiqiao Pu <ypu@redhat.com>2018-04-16 10:55:29 +0800
commitf1a4867bcd4db4e5299225c0e7a35451ec0de7db (patch)
tree98815851d27a9d20ae6abd7fdd9a0cf34054e4f5 /test/e2e/libpod_suite_test.go
parentd6d7edb841a8c3044c81386fdb4113dd895a26f3 (diff)
downloadpodman-f1a4867bcd4db4e5299225c0e7a35451ec0de7db.tar.gz
podman-f1a4867bcd4db4e5299225c0e7a35451ec0de7db.tar.bz2
podman-f1a4867bcd4db4e5299225c0e7a35451ec0de7db.zip
Add a function for check if command exist
Use this function to check if command exist before execute it in our test. Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 8887fd96e..fa48334a3 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -612,3 +612,13 @@ func WaitContainerReady(p *PodmanTest, id string, expStr string, timeout int, st
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
+}