From c80bfe1be1632635845bfcf46404da87e297c57b Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 16 Mar 2018 13:28:24 -0400 Subject: Fix Travis tests for sig-proxy Signed-off-by: Matthew Heon Closes: #511 Approved by: rhatdan --- test/e2e/libpod_suite_test.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'test/e2e') 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 { -- cgit v1.2.3-54-g00ecf