mirror of
https://github.com/containers/podman.git
synced 2025-11-30 18:18:18 +08:00
Podman pod stats -- fix GO template output
Go templates were not being processed or printed correctly for podman pod stats. Added the ability to do templates as well as honor the table identifier. Fixes #2258 Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@@ -147,5 +147,28 @@ var _ = Describe("Podman pod stats", func() {
|
||||
Expect(stats.ExitCode()).To(Equal(0))
|
||||
Expect(stats.IsJSONOutputValid()).To(BeTrue())
|
||||
})
|
||||
It("podman stats with GO template", func() {
|
||||
_, ec, podid := podmanTest.CreatePod("")
|
||||
Expect(ec).To(Equal(0))
|
||||
|
||||
session := podmanTest.RunTopContainerInPod("", podid)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
stats := podmanTest.Podman([]string{"pod", "stats", "-a", "--no-reset", "--no-stream", "--format", "\"table {{.CID}} {{.Pod}} {{.Mem}} {{.MemUsage}} {{.CPU}} {{.NetIO}} {{.BlockIO}} {{.PIDS}} {{.Pod}}\""})
|
||||
stats.WaitWithDefaultTimeout()
|
||||
Expect(stats.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman stats with invalid GO template", func() {
|
||||
_, ec, podid := podmanTest.CreatePod("")
|
||||
Expect(ec).To(Equal(0))
|
||||
|
||||
session := podmanTest.RunTopContainerInPod("", podid)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
stats := podmanTest.Podman([]string{"pod", "stats", "-a", "--no-reset", "--no-stream", "--format", "\"table {{.ID}} \""})
|
||||
stats.WaitWithDefaultTimeout()
|
||||
Expect(stats.ExitCode()).ToNot(Equal(0))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user