diff options
author | Qi Wang <qiwan@redhat.com> | 2019-05-20 17:23:03 -0400 |
---|---|---|
committer | Qi Wang <qiwan@redhat.com> | 2019-08-02 11:47:43 -0400 |
commit | 0ad374af6a7552a68736e68fd4093809844a171f (patch) | |
tree | e6c6e68a399b510c2718f76acf813f763967a7f3 /test/e2e/events_test.go | |
parent | 3cc9ab8992833ddf952df479ffb239c61845fa2e (diff) | |
download | podman-0ad374af6a7552a68736e68fd4093809844a171f.tar.gz podman-0ad374af6a7552a68736e68fd4093809844a171f.tar.bz2 podman-0ad374af6a7552a68736e68fd4093809844a171f.zip |
podman events format json
Enable podman events to format the output as jsonline
Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'test/e2e/events_test.go')
-rw-r--r-- | test/e2e/events_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index c5eedda3c..0636af74c 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -1,6 +1,7 @@ package integration import ( + "encoding/json" "fmt" "os" "strings" @@ -116,4 +117,25 @@ var _ = Describe("Podman events", func() { Expect(result.ExitCode()).To(BeZero()) }) + It("podman events format", func() { + info := GetHostDistributionInfo() + if info.Distribution != "fedora" { + Skip("need to verify images have correct packages for journald") + } + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + test := podmanTest.Podman([]string{"events", "--stream=false", "--format", "json"}) + test.WaitWithDefaultTimeout() + fmt.Println(test.OutputToStringArray()) + jsonArr := test.OutputToStringArray() + Expect(len(jsonArr)).To(Not(BeZero())) + eventsMap := make(map[string]string) + err := json.Unmarshal([]byte(jsonArr[0]), &eventsMap) + if err != nil { + os.Exit(1) + } + _, exist := eventsMap["Status"] + Expect(exist).To(BeTrue()) + Expect(test.ExitCode()).To(BeZero()) + }) }) |