From 28a2bf827ae9f592ddd9e5c11277606d32cf329c Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 17 Sep 2018 07:58:34 -0400 Subject: Add new tests for ipc namespace sharing We seem to be having a few flakes on namespace sharing. Adding this test to make sure sharing with the host is working correctly. Signed-off-by: Daniel J Walsh Closes: #1485 Approved by: mheon --- test/e2e/run_ns_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go index a61b4ab03..88c0b1ad2 100644 --- a/test/e2e/run_ns_test.go +++ b/test/e2e/run_ns_test.go @@ -3,6 +3,7 @@ package integration import ( "fmt" "os" + "strings" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -59,6 +60,36 @@ var _ = Describe("Podman run ns", func() { Expect(session.OutputToString()).To(Equal(hostShm)) }) + It("podman run ipcns ipcmk host test", func() { + setup := podmanTest.SystemExec("ipcmk", []string{"-M", "1024"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + output := strings.Split(setup.OutputToString(), " ") + ipc := output[len(output)-1] + session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ipcs", "-m", "-i", ipc}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + setup = podmanTest.SystemExec("ipcrm", []string{"-m", ipc}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + }) + + It("podman run ipcns ipcmk container test", func() { + setup := podmanTest.Podman([]string{"run", "-d", "--name", "test1", fedoraMinimal, "sleep", "999"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"exec", "test1", "ipcmk", "-M", "1024"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + output := strings.Split(session.OutputToString(), " ") + ipc := output[len(output)-1] + session = podmanTest.Podman([]string{"run", "--ipc=container:test1", fedoraMinimal, "ipcs", "-m", "-i", ipc}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + It("podman run bad ipc pid test", func() { session := podmanTest.Podman([]string{"run", "--ipc=badpid", fedoraMinimal, "bash", "-c", "echo $$"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf