summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/pod_stats.go2
-rw-r--r--test/e2e/pod_stats_test.go38
2 files changed, 39 insertions, 1 deletions
diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go
index e46c728ab..ae371da6f 100644
--- a/cmd/podman/pod_stats.go
+++ b/cmd/podman/pod_stats.go
@@ -228,7 +228,7 @@ func getPodsByList(podList []string, r *libpod.Runtime) ([]*libpod.Pod, error) {
pods []*libpod.Pod
)
for _, p := range podList {
- pod, err := r.GetPod(p)
+ pod, err := r.LookupPod(p)
if err != nil {
return nil, err
}
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index 692946f33..b7f939aa9 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -61,6 +61,44 @@ var _ = Describe("Podman pod stats", func() {
Expect(stats.ExitCode()).To(Equal(0))
})
+ It("podman stats on a specific running pod with shortID", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podid := session.OutputToString()
+
+ session = podmanTest.RunTopContainerInPod("", podid)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.RunTopContainerInPod("", podid)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream", podid[:5]})
+ stats.WaitWithDefaultTimeout()
+ Expect(stats.ExitCode()).To(Equal(0))
+ })
+
+ It("podman stats on a specific running pod with name", func() {
+ session := podmanTest.Podman([]string{"pod", "create", "--name", "test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podid := session.OutputToString()
+
+ session = podmanTest.RunTopContainerInPod("", podid)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.RunTopContainerInPod("", podid)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream", "test"})
+ stats.WaitWithDefaultTimeout()
+ Expect(stats.ExitCode()).To(Equal(0))
+ })
+
It("podman stats on running pods", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()