summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-07-13 13:57:04 -0400
committerGitHub <noreply@github.com>2018-07-13 13:57:04 -0400
commit827359c8e6b116b839a95460cc1775a11f84b682 (patch)
tree2c75493ec56ff9f882c766c56f128d933b0dab8b /test/e2e/libpod_suite_test.go
parent35b7a875fd9747a6f322e12f358aeacea778eae5 (diff)
parenta04a8d1dd4d375ebe5084bac760dc82f88cfc77f (diff)
downloadpodman-827359c8e6b116b839a95460cc1775a11f84b682.tar.gz
podman-827359c8e6b116b839a95460cc1775a11f84b682.tar.bz2
podman-827359c8e6b116b839a95460cc1775a11f84b682.zip
Merge pull request #1065 from haircommander/pod-start-create-rm
Podman pod create/rm/ps commands with man pages and tests
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 448dbfc04..6ec995bfc 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -224,6 +224,17 @@ func (p *PodmanTest) Cleanup() {
}
}
+// CleanupPod cleans up the temporary store
+func (p *PodmanTest) CleanupPod() {
+ // Remove all containers
+ session := p.Podman([]string{"pod", "rm", "-fa"})
+ session.Wait(90)
+ // Nuke tempdir
+ if err := os.RemoveAll(p.TempDir); err != nil {
+ fmt.Printf("%q\n", err)
+ }
+}
+
// GrepString takes session output and behaves like grep. it returns a bool
// if successful and an array of strings on positive matches
func (s *PodmanSession) GrepString(term string) (bool, []string) {
@@ -459,6 +470,15 @@ func (p *PodmanTest) RunTopContainer(name string) *PodmanSession {
return p.Podman(podmanArgs)
}
+func (p *PodmanTest) RunTopContainerInPod(name, pod string) *PodmanSession {
+ var podmanArgs = []string{"run", "--pod", pod}
+ if name != "" {
+ podmanArgs = append(podmanArgs, "--name", name)
+ }
+ podmanArgs = append(podmanArgs, "-d", ALPINE, "top")
+ return p.Podman(podmanArgs)
+}
+
//RunLsContainer runs a simple container in the background that
// simply runs ls. If the name passed != "", it will have a name
func (p *PodmanTest) RunLsContainer(name string) (*PodmanSession, int, string) {
@@ -472,6 +492,17 @@ func (p *PodmanTest) RunLsContainer(name string) (*PodmanSession, int, string) {
return session, session.ExitCode(), session.OutputToString()
}
+func (p *PodmanTest) RunLsContainerInPod(name, pod string) (*PodmanSession, int, string) {
+ var podmanArgs = []string{"run", "--pod", pod}
+ if name != "" {
+ podmanArgs = append(podmanArgs, "--name", name)
+ }
+ podmanArgs = append(podmanArgs, "-d", ALPINE, "ls")
+ session := p.Podman(podmanArgs)
+ session.WaitWithDefaultTimeout()
+ return session, session.ExitCode(), session.OutputToString()
+}
+
//NumberOfContainersRunning returns an int of how many
// containers are currently running.
func (p *PodmanTest) NumberOfContainersRunning() int {
@@ -502,6 +533,21 @@ func (p *PodmanTest) NumberOfContainers() int {
return len(containers)
}
+// NumberOfPods returns an int of how many
+// pods are currently defined.
+func (p *PodmanTest) NumberOfPods() int {
+ var pods []string
+ ps := p.Podman([]string{"pod", "ps", "-q"})
+ ps.WaitWithDefaultTimeout()
+ Expect(ps.ExitCode()).To(Equal(0))
+ for _, i := range ps.OutputToStringArray() {
+ if i != "" {
+ pods = append(pods, i)
+ }
+ }
+ return len(pods)
+}
+
// NumberOfRunningContainers returns an int of how many containers are currently
// running
func (p *PodmanTest) NumberOfRunningContainers() int {