summaryrefslogtreecommitdiff
path: root/pkg/bindings/test
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-03-26 11:13:45 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-03-27 09:14:01 +0100
commit500a2d508bc8babe8234f259ab51d4908daf9378 (patch)
treee26e59d60eab94ee1321312e38636042edd6f33a /pkg/bindings/test
parent1710eca4e930f7ed3a2b060029c627c1a66a2349 (diff)
downloadpodman-500a2d508bc8babe8234f259ab51d4908daf9378.tar.gz
podman-500a2d508bc8babe8234f259ab51d4908daf9378.tar.bz2
podman-500a2d508bc8babe8234f259ab51d4908daf9378.zip
podmanV2: implement top
Implement the `top` command for podmanV2. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/bindings/test')
-rw-r--r--pkg/bindings/test/containers_test.go32
1 files changed, 31 insertions, 1 deletions
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index 55c739865..9dd9cb707 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -34,7 +34,7 @@ var _ = Describe("Podman containers ", func() {
AfterEach(func() {
s.Kill()
- //bt.cleanup()
+ bt.cleanup()
})
It("podman pause a bogus container", func() {
@@ -380,4 +380,34 @@ var _ = Describe("Podman containers ", func() {
_, err = time.Parse(time.RFC1123Z, o)
Expect(err).To(BeNil())
})
+
+ It("podman top", func() {
+ var name = "top"
+ cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil)
+ Expect(err).To(BeNil())
+
+ // By name
+ output, err := containers.Top(bt.conn, name, nil)
+ Expect(err).To(BeNil())
+
+ // By id
+ output, err = containers.Top(bt.conn, cid, nil)
+ Expect(err).To(BeNil())
+
+ // With descriptors
+ output, err = containers.Top(bt.conn, cid, []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 = containers.Top(bt.conn, "IdoNotExist", nil)
+ Expect(err).ToNot(BeNil())
+
+ // With bogus descriptors
+ _, err = containers.Top(bt.conn, cid, []string{"Me,Neither"})
+ Expect(err).To(BeNil())
+ })
})