aboutsummaryrefslogtreecommitdiff
path: root/test/e2e/stats_test.go
diff options
context:
space:
mode:
authorJake Correnti <jcorrenti13@gmail.com>2022-06-13 13:33:19 -0400
committerJake Correnti <jcorrenti13@gmail.com>2022-06-13 15:03:22 -0400
commit608ad7d1139d80093d1ddd933027d31af7fdee83 (patch)
tree16d53c9568b86faf520501466618b4df7b8cad1c /test/e2e/stats_test.go
parent1ada01a038fceaa9e94beb2de6e4593df03be7fa (diff)
downloadpodman-608ad7d1139d80093d1ddd933027d31af7fdee83.tar.gz
podman-608ad7d1139d80093d1ddd933027d31af7fdee83.tar.bz2
podman-608ad7d1139d80093d1ddd933027d31af7fdee83.zip
Non-running containers now report statistics via the `podman stats`
command Previously, if a container was not running, and the user ran the `podman stats` command, an error would be reported: `Error: container state improper`. Podman now reports stats as the fields' default values for their respective type if the container is not running: ``` $ podman stats --no-stream demo ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU % 4b4bf8ce84ed demo 0.00% 0B / 0B 0.00% 0B / 0B 0B / 0B 0 0s 0.00% ``` Closes: #14498 Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
Diffstat (limited to 'test/e2e/stats_test.go')
-rw-r--r--test/e2e/stats_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index b43a81cd3..3000a819f 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -236,4 +236,15 @@ var _ = Describe("Podman stats", func() {
Expect(customLimit).To(BeNumerically("<", defaultLimit))
})
+
+ It("podman stats with a container that is not running", func() {
+ ctr := "created_container"
+ session := podmanTest.Podman([]string{"create", "--name", ctr, ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"stats", "--no-stream", ctr})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ })
})