summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-16 13:28:24 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-16 18:03:25 +0000
commitc80bfe1be1632635845bfcf46404da87e297c57b (patch)
tree738af97c19f010b28132179cb8beda2b9f659ab3 /test/e2e/libpod_suite_test.go
parentca7758aa81eae0e1f210d644ccdf5e5d7edaa3f5 (diff)
downloadpodman-c80bfe1be1632635845bfcf46404da87e297c57b.tar.gz
podman-c80bfe1be1632635845bfcf46404da87e297c57b.tar.bz2
podman-c80bfe1be1632635845bfcf46404da87e297c57b.zip
Fix Travis tests for sig-proxy
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #511 Approved by: rhatdan
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-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 {