Enable pod stats with short ID and name

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1307
Approved by: rhatdan
This commit is contained in:
haircommander
2018-08-20 18:29:44 -04:00
committed by Atomic Bot
parent 7e94fbb493
commit 021027a24b
2 changed files with 39 additions and 1 deletions

View File

@ -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
}

View File

@ -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()