summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/common_test.go10
-rw-r--r--test/e2e/start_test.go17
-rw-r--r--test/utils/utils.go2
3 files changed, 16 insertions, 13 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 42507f58c..b390df8b2 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -78,11 +78,15 @@ func (a testResultsSorted) Less(i, j int) bool { return a[i].length < a[j].lengt
var testResults []testResult
-// TestLibpod ginkgo master function
-func TestLibpod(t *testing.T) {
+func TestMain(m *testing.M) {
if reexec.Init() {
- os.Exit(1)
+ return
}
+ os.Exit(m.Run())
+}
+
+// TestLibpod ginkgo master function
+func TestLibpod(t *testing.T) {
if os.Getenv("NOCACHE") == "1" {
CACHE_IMAGES = []string{}
RESTORE_IMAGES = []string{}
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index fc1203ed1..06ab6aacd 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman start", func() {
@@ -107,32 +108,30 @@ var _ = Describe("Podman start", func() {
start := podmanTest.Podman([]string{"start", "-l"})
start.WaitWithDefaultTimeout()
- Expect(start.ExitCode()).To(Not(Equal(0)))
+ Expect(start.ExitCode()).Should(BeNumerically(">", 0))
- numContainers := podmanTest.NumberOfContainers()
- Expect(numContainers).To(BeZero())
+ Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout).Should(BeZero())
})
It("podman failed to start without --rm should NOT delete the container", func() {
session := podmanTest.Podman([]string{"create", "-it", ALPINE, "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
start := podmanTest.Podman([]string{"start", "-l"})
start.WaitWithDefaultTimeout()
- Expect(start.ExitCode()).To(Not(Equal(0)))
+ Expect(start.ExitCode()).Should(BeNumerically(">", 0))
- numContainers := podmanTest.NumberOfContainers()
- Expect(numContainers).To(Equal(1))
+ Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout).Should(Equal(1))
})
It("podman start --sig-proxy should not work without --attach", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "-l", "--sig-proxy"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
})
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 6dee92f5d..7d373bd56 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -316,7 +316,7 @@ func (s *PodmanSession) IsJSONOutputValid() bool {
// WaitWithDefaultTimeout waits for process finished with defaultWaitTimeout
func (s *PodmanSession) WaitWithDefaultTimeout() {
- s.Wait(defaultWaitTimeout)
+ Eventually(s, defaultWaitTimeout).Should(gexec.Exit())
os.Stdout.Sync()
os.Stderr.Sync()
fmt.Println("output:", s.OutputToString())