diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-02-11 20:50:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 20:50:28 +0100 |
commit | cbce43a86589325388e1d6a789e96cb8f66ba3a8 (patch) | |
tree | e0c832543c8fb403734021dde2591b815fd2eeee /pkg/bindings/test/common_test.go | |
parent | 86b5a89d1afb641196214ed9c57e83e617776c5f (diff) | |
parent | f7f7a8cbadddcfd37cae2ce91d7e595d58a707b3 (diff) | |
download | podman-cbce43a86589325388e1d6a789e96cb8f66ba3a8.tar.gz podman-cbce43a86589325388e1d6a789e96cb8f66ba3a8.tar.bz2 podman-cbce43a86589325388e1d6a789e96cb8f66ba3a8.zip |
Merge pull request #5132 from sujil02/test
Add test cases to validate remove and list images api.
Diffstat (limited to 'pkg/bindings/test/common_test.go')
-rw-r--r-- | pkg/bindings/test/common_test.go | 32 |
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 +} |