diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-27 13:55:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-27 13:55:17 +0100 |
commit | 7007680bfdee8c36b855a97ee45d268b24bde7d3 (patch) | |
tree | 8680b8ca2e099234e83816c1c71a64e28acc8156 /pkg/bindings/test | |
parent | 340312cc1b4487f6f23cd6b671e7ed71a8421eb8 (diff) | |
parent | 500a2d508bc8babe8234f259ab51d4908daf9378 (diff) | |
download | podman-7007680bfdee8c36b855a97ee45d268b24bde7d3.tar.gz podman-7007680bfdee8c36b855a97ee45d268b24bde7d3.tar.bz2 podman-7007680bfdee8c36b855a97ee45d268b24bde7d3.zip |
Merge pull request #5618 from vrothberg/v2-top
podmanV2: implement top
Diffstat (limited to 'pkg/bindings/test')
-rw-r--r-- | pkg/bindings/test/containers_test.go | 32 |
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()) + }) }) |