diff options
author | haircommander <pehunt@redhat.com> | 2018-08-20 18:29:44 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-21 14:34:08 +0000 |
commit | 021027a24b7b6906a2d7ed86c67e34167bc26284 (patch) | |
tree | d4f4aeaca4dce8a7fb776d22dea8e29f4b13dec4 | |
parent | 7e94fbb4936d189cd79e2159859f0f8aa02584e6 (diff) | |
download | podman-021027a24b7b6906a2d7ed86c67e34167bc26284.tar.gz podman-021027a24b7b6906a2d7ed86c67e34167bc26284.tar.bz2 podman-021027a24b7b6906a2d7ed86c67e34167bc26284.zip |
Enable pod stats with short ID and name
Signed-off-by: haircommander <pehunt@redhat.com>
Closes: #1307
Approved by: rhatdan
-rw-r--r-- | cmd/podman/pod_stats.go | 2 | ||||
-rw-r--r-- | test/e2e/pod_stats_test.go | 38 |
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() |