aboutsummaryrefslogtreecommitdiff
path: root/pkg/bindings/test/common_test.go
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-02-10 12:05:07 -0500
committerSujil02 <sushah@redhat.com>2020-02-10 12:07:35 -0500
commitf7f7a8cbadddcfd37cae2ce91d7e595d58a707b3 (patch)
tree794cfa477d8f289d86984f10a4a737fba18aa906 /pkg/bindings/test/common_test.go
parentc02b3b5e139de90f7e03a5b08b5c49add8107380 (diff)
downloadpodman-f7f7a8cbadddcfd37cae2ce91d7e595d58a707b3.tar.gz
podman-f7f7a8cbadddcfd37cae2ce91d7e595d58a707b3.tar.bz2
podman-f7f7a8cbadddcfd37cae2ce91d7e595d58a707b3.zip
Add test cases to validate remove and list images api.
Includes testcase to validate list image api count as we create and delete images Include testcase to validate remove image api responses with container instance, etc. Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'pkg/bindings/test/common_test.go')
-rw-r--r--pkg/bindings/test/common_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/pkg/bindings/test/common_test.go b/pkg/bindings/test/common_test.go
index 15783041f..22cd0b7e0 100644
--- a/pkg/bindings/test/common_test.go
+++ b/pkg/bindings/test/common_test.go
@@ -16,6 +16,7 @@ import (
const (
defaultPodmanBinaryLocation string = "/usr/bin/podman"
alpine string = "docker.io/library/alpine:latest"
+ busybox string = "docker.io/library/busybox:latest"
)
type bindingTest struct {
@@ -113,7 +114,38 @@ func (b *bindingTest) startAPIService() *gexec.Session {
}
func (b *bindingTest) cleanup() {
+ s := b.runPodman([]string{"stop", "-a", "-t", "0"})
+ s.Wait(45)
if err := os.RemoveAll(b.tempDirPath); err != nil {
fmt.Println(err)
}
}
+
+// Pull is a helper function to pull in images
+func (b *bindingTest) Pull(name string) {
+ p := b.runPodman([]string{"pull", name})
+ p.Wait(45)
+}
+
+// Run a container and add append the alpine image to it
+func (b *bindingTest) RunTopContainer(name *string) {
+ cmd := []string{"run", "-dt"}
+ if name != nil {
+ containerName := *name
+ cmd = append(cmd, "--name", containerName)
+ }
+ cmd = append(cmd, alpine, "top")
+ p := b.runPodman(cmd)
+ p.Wait(45)
+}
+
+// StringInSlice returns a boolean based on whether a given
+// string is in a given slice
+func StringInSlice(s string, sl []string) bool {
+ for _, val := range sl {
+ if s == val {
+ return true
+ }
+ }
+ return false
+}