summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/e2e/libpod_suite_test.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 634c38b29..5bdc112fb 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -170,7 +170,7 @@ func (p *PodmanTest) Podman(args []string) *PodmanSession {
//WaitForContainer waits on a started container
func WaitForContainer(p *PodmanTest) bool {
for i := 0; i < 10; i++ {
- if p.NumberOfContainers() == 1 {
+ if p.NumberOfRunningContainers() == 1 {
return true
}
time.Sleep(1 * time.Second)
@@ -414,7 +414,7 @@ func (p *PodmanTest) NumberOfContainersRunning() int {
return len(containers)
}
-//NumberOfContainersreturns an int of how many
+// NumberOfContainers returns an int of how many
// containers are currently defined.
func (p *PodmanTest) NumberOfContainers() int {
var containers []string
@@ -429,6 +429,21 @@ func (p *PodmanTest) NumberOfContainers() int {
return len(containers)
}
+// NumberOfRunningContainers returns an int of how many containers are currently
+// running
+func (p *PodmanTest) NumberOfRunningContainers() int {
+ var containers []string
+ ps := p.Podman([]string{"ps", "-q"})
+ ps.WaitWithDefaultTimeout()
+ Expect(ps.ExitCode()).To(Equal(0))
+ for _, i := range ps.OutputToStringArray() {
+ if i != "" {
+ containers = append(containers, i)
+ }
+ }
+ return len(containers)
+}
+
// StringInSlice determines if a string is in a string slice, returns bool
func StringInSlice(s string, sl []string) bool {
for _, i := range sl {