diff options
author | baude <bbaude@redhat.com> | 2018-02-26 09:08:19 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-02-26 23:41:47 +0000 |
commit | 6cb1c31d3f9e575688ace95206898c7fff0c88f9 (patch) | |
tree | 70bd6b99e6e8068abfadbd224126512d9625bb00 /test/e2e | |
parent | f47a5be60d91fd2055ed6afbb6bb014c9635f2df (diff) | |
download | podman-6cb1c31d3f9e575688ace95206898c7fff0c88f9.tar.gz podman-6cb1c31d3f9e575688ace95206898c7fff0c88f9.tar.bz2 podman-6cb1c31d3f9e575688ace95206898c7fff0c88f9.zip |
Restrict top output to container's pids only
Due to the way ps arguments work, it was possible to display pids
that dont below to the container in top output. We now filter pids
that dont belong to the container out of the output. This also means
the pid column must be present in the output or we throw an error.
This resolves issue #391
Signed-off-by: baude <bbaude@redhat.com>
Closes: #400
Approved by: rhatdan
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/top_test.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go index d4438293b..410803353 100644 --- a/test/e2e/top_test.go +++ b/test/e2e/top_test.go @@ -59,14 +59,26 @@ var _ = Describe("Podman top", func() { Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1)) }) - It("podman top on non-running container", func() { + It("podman top with options", func() { session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top", "-d", "2"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - result := podmanTest.Podman([]string{"top", session.OutputToString(), "-o", "fuser,f,comm,label"}) + result := podmanTest.Podman([]string{"top", session.OutputToString(), "-o", "pid,fuser,f,comm,label"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1)) }) + + It("podman top on container invalid options", func() { + sleep := podmanTest.RunSleepContainer("") + sleep.WaitWithDefaultTimeout() + Expect(sleep.ExitCode()).To(Equal(0)) + cid := sleep.OutputToString() + + result := podmanTest.Podman([]string{"top", cid, "-o time"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(125)) + }) + }) |