summaryrefslogtreecommitdiff
path: root/test/e2e/events_test.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-11-23 07:33:35 -0700
committerEd Santiago <santiago@redhat.com>2021-11-23 15:39:04 -0700
commiteb3708a5243378a659ca126b5d5c457b182d16a8 (patch)
tree60b55542ad9db7510a782712d2ef0b36cdf82f28 /test/e2e/events_test.go
parentc034147fe72a233b8c1ef33d00e9d0747053c262 (diff)
downloadpodman-eb3708a5243378a659ca126b5d5c457b182d16a8.tar.gz
podman-eb3708a5243378a659ca126b5d5c457b182d16a8.tar.bz2
podman-eb3708a5243378a659ca126b5d5c457b182d16a8.zip
Find and fix empty Expect()s
That previous commit made me wonder if there are any other instances of Expect() with no assertions. grep Expect test/e2e/*_test.go |egrep -v '\.(To|NotTo|Should)' ...finds a couple of handfuls, most of which are OK (continued on the next line) but a few of which are bugs. Fix those. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/events_test.go')
-rw-r--r--test/e2e/events_test.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index ee0b8761a..2b9b0f575 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"os"
- "strings"
"sync"
"time"
@@ -62,12 +61,10 @@ var _ = Describe("Podman events", func() {
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray()) >= 1)
+ Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events")
})
It("podman events with an event filter and container=cid", func() {
- Skip("Does not work on v2")
- SkipIfNotFedora()
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
_, ec2, cid2 := podmanTest.RunLsContainer("")
@@ -76,8 +73,10 @@ var _ = Describe("Podman events", func() {
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start", "--filter", fmt.Sprintf("container=%s", cid)})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(1))
- Expect(!strings.Contains(result.OutputToString(), cid2))
+ events := result.OutputToStringArray()
+ Expect(len(events)).To(Equal(1), "number of events")
+ Expect(events[0]).To(ContainSubstring(cid), "event log includes CID")
+ Expect(events[0]).To(Not(ContainSubstring(cid2)), "event log does not include second CID")
})
It("podman events with a type and filter container=id", func() {
@@ -101,8 +100,12 @@ var _ = Describe("Podman events", func() {
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod", "--filter", "pod=foobarpod"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- fmt.Println(result.OutputToStringArray())
- Expect(len(result.OutputToStringArray()) >= 2)
+ events := result.OutputToStringArray()
+ fmt.Println(events)
+ Expect(len(events)).To(BeNumerically(">=", 2), "Number of events")
+ Expect(events).To(ContainElement(ContainSubstring(" pod create ")))
+ Expect(events).To(ContainElement(ContainSubstring(" pod stop ")))
+ Expect(events).To(ContainElement(ContainSubstring("name=foobarpod")))
})
It("podman events --since", func() {