summaryrefslogtreecommitdiff
path: root/test/e2e/top_test.go
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@suse.com>2018-07-19 14:41:58 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-19 20:47:52 +0000
commitba1871dac033783ab0329c9b3c9113a34a90992f (patch)
treef0be2944ff09d857306ea42864c7b24ae86ae9bd /test/e2e/top_test.go
parent98703eb204923f06555605c648fc165a55214520 (diff)
downloadpodman-ba1871dac033783ab0329c9b3c9113a34a90992f.tar.gz
podman-ba1871dac033783ab0329c9b3c9113a34a90992f.tar.bz2
podman-ba1871dac033783ab0329c9b3c9113a34a90992f.zip
podman-top: use containers/psgo
Use github.com/containers/psgo instead of execing `ps (1)`. The psgo library enables a much more flexible interface with respect to which data to be printed (e.g., capabilities, seccomp mode, PID, PCPU, etc.) while the output can be parsed reliably. The library does not use ps (1) but parses /proc and /dev instead. To list the processes of a given container, psgo will join the mount namespace of the given container and extract all data from there. Notice that this commit breaks compatibility with docker-top. Signed-off-by: Valentin Rothberg <vrothberg@suse.com> Closes: #1113 Approved by: rhatdan
Diffstat (limited to 'test/e2e/top_test.go')
-rw-r--r--test/e2e/top_test.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go
index e7ac90219..d26a19ba4 100644
--- a/test/e2e/top_test.go
+++ b/test/e2e/top_test.go
@@ -59,32 +59,24 @@ var _ = Describe("Podman top", func() {
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
- // XXX(ps-issue): for the time being, podman-top and the libpod API
- // GetContainerPidInformation(...) will ignore any arguments passed to ps,
- // so we have to disable the tests below. Please refer to
- // https://github.com/projectatomic/libpod/pull/939 for more background
- // information.
-
It("podman top with options", func() {
- Skip("podman-top with options: options are temporarily ignored")
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", "pid,fuser,f,comm,label"})
+ result := podmanTest.Podman([]string{"top", session.OutputToString(), "pid", "%C", "args"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman top on container invalid options", func() {
- Skip("podman-top with invalid options: options are temporarily ignored")
top := podmanTest.RunTopContainer("")
top.WaitWithDefaultTimeout()
Expect(top.ExitCode()).To(Equal(0))
cid := top.OutputToString()
- result := podmanTest.Podman([]string{"top", cid, "-o time"})
+ result := podmanTest.Podman([]string{"top", cid, "invalid"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(125))
})