mirror of
https://github.com/containers/podman.git
synced 2025-12-01 18:49:18 +08:00
podman top: join the container userns
When we execute ps(1) in the container and the container uses a userns with a different id mapping the user id field will be wrong. To fix this we must join the userns in such case. Fixes #22293 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@@ -119,6 +119,18 @@ var _ = Describe("Podman top", func() {
|
||||
exec := podmanTest.Podman([]string{"top", session.OutputToString(), "aux"})
|
||||
exec.WaitWithDefaultTimeout()
|
||||
Expect(exec).Should(ExitWithError(125, "OCI runtime attempted to invoke a command that was not found"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "-d", "--uidmap=0:1000:1000", "--user", "9", fedoraMinimal, "sleep", "inf"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result = podmanTest.Podman([]string{"top", session.OutputToString(), "-ef", "hn"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
Expect(output).To(ContainSubstring("sleep inf"))
|
||||
// check for https://github.com/containers/podman/issues/22293
|
||||
Expect(output).To(HavePrefix("9 "), "user id of process")
|
||||
})
|
||||
|
||||
It("podman top with comma-separated options", func() {
|
||||
|
||||
Reference in New Issue
Block a user