summaryrefslogtreecommitdiff
path: root/test/e2e/run_ns_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-07-28 09:18:21 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-07-28 14:53:54 -0400
commitbb4d269087d11623e15d1aa3c8cb197f29a601d1 (patch)
tree1927db4a75af39689b937df14c30c423f00bea08 /test/e2e/run_ns_test.go
parent288ebec6e737c105fa0ef43412de4e0a8997feb9 (diff)
downloadpodman-bb4d269087d11623e15d1aa3c8cb197f29a601d1.tar.gz
podman-bb4d269087d11623e15d1aa3c8cb197f29a601d1.tar.bz2
podman-bb4d269087d11623e15d1aa3c8cb197f29a601d1.zip
Specifying --ipc=host --pid=host is broken
For some reason we were overwriting memory when handling both --pid=host and --ipc=host. Simplified the code to handle this correctly, and add test to make sure it does not happen again. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e/run_ns_test.go')
-rw-r--r--test/e2e/run_ns_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go
index 2b6da2888..5242e04d2 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -2,6 +2,7 @@ package integration
import (
"os"
+ "os/exec"
"strings"
. "github.com/containers/podman/v2/test/utils"
@@ -102,4 +103,34 @@ var _ = Describe("Podman run ns", func() {
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
})
+
+ It("podman run --ipc=host --pid=host", func() {
+ cmd := exec.Command("ls", "-l", "/proc/self/ns/pid")
+ res, err := cmd.Output()
+ Expect(err).To(BeNil())
+ fields := strings.Split(string(res), " ")
+ hostPidNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
+
+ cmd = exec.Command("ls", "-l", "/proc/self/ns/ipc")
+ res, err = cmd.Output()
+ Expect(err).To(BeNil())
+ fields = strings.Split(string(res), " ")
+ hostIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
+
+ session := podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/pid"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ fields = strings.Split(session.OutputToString(), " ")
+ ctrPidNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
+
+ session = podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/ipc"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ fields = strings.Split(session.OutputToString(), " ")
+ ctrIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
+
+ Expect(hostPidNS).To(Equal(ctrPidNS))
+ Expect(hostIpcNS).To(Equal(ctrIpcNS))
+ })
+
})