summaryrefslogtreecommitdiff
path: root/pkg/bindings/test/pods_test.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-03-27 11:46:33 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-03-28 17:32:22 +0100
commit9812804f754120fcf14256bf0ed9cd00c36bf9f7 (patch)
treef9412fd2ac6cdfba7c688aaf122c97e5f2e1701a /pkg/bindings/test/pods_test.go
parentcc129d13c5b8b80f542dbc6192ff3d5df29b47ee (diff)
downloadpodman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.tar.gz
podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.tar.bz2
podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.zip
podmanv2: implement pod top
Implement `podman pod top` for podmanV2. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/bindings/test/pods_test.go')
-rw-r--r--pkg/bindings/test/pods_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/bindings/test/pods_test.go b/pkg/bindings/test/pods_test.go
index 0f786e341..2599ec7ef 100644
--- a/pkg/bindings/test/pods_test.go
+++ b/pkg/bindings/test/pods_test.go
@@ -2,6 +2,7 @@ package test_bindings
import (
"net/http"
+ "strings"
"time"
"github.com/containers/libpod/libpod/define"
@@ -319,4 +320,33 @@ var _ = Describe("Podman pods", func() {
Expect(err).To(BeNil())
Expect(exists).To(BeTrue())
})
+
+ // Test validates the pod top bindings
+ It("pod top", func() {
+ var name string = "podA"
+
+ bt.Podcreate(&name)
+ _, err := pods.Start(bt.conn, name)
+ Expect(err).To(BeNil())
+
+ // By name
+ _, err = pods.Top(bt.conn, name, nil)
+ Expect(err).To(BeNil())
+
+ // With descriptors
+ output, err := pods.Top(bt.conn, name, []string{"user,pid,hpid"})
+ Expect(err).To(BeNil())
+ header := strings.Split(output[0], "\t")
+ for _, d := range []string{"USER", "PID", "HPID"} {
+ Expect(d).To(BeElementOf(header))
+ }
+
+ // With bogus ID
+ _, err = pods.Top(bt.conn, "IdoNotExist", nil)
+ Expect(err).ToNot(BeNil())
+
+ // With bogus descriptors
+ _, err = pods.Top(bt.conn, name, []string{"Me,Neither"})
+ Expect(err).ToNot(BeNil())
+ })
})