summaryrefslogtreecommitdiff
path: root/test/e2e/pod_pod_namespaces_test.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-11-17 21:12:45 +0100
committerPaul Holzinger <paul.holzinger@web.de>2020-11-17 21:18:27 +0100
commitd4446501f3245a87a605bea403710954f0400fb5 (patch)
treed636225b50c7c6ef7ce28cd8e0a988c01bb26b26 /test/e2e/pod_pod_namespaces_test.go
parent65880e556314d1d8cb3cf12e20666b823eab8c76 (diff)
downloadpodman-d4446501f3245a87a605bea403710954f0400fb5.tar.gz
podman-d4446501f3245a87a605bea403710954f0400fb5.tar.bz2
podman-d4446501f3245a87a605bea403710954f0400fb5.zip
Rename e2e test files to include _test.go suffix
The test were working fine. Just my IDE doesn't like the files without the suffix and I don't like red errors. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'test/e2e/pod_pod_namespaces_test.go')
-rw-r--r--test/e2e/pod_pod_namespaces_test.go109
1 files changed, 109 insertions, 0 deletions
diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go
new file mode 100644
index 000000000..20b8bdb39
--- /dev/null
+++ b/test/e2e/pod_pod_namespaces_test.go
@@ -0,0 +1,109 @@
+package integration
+
+import (
+ "fmt"
+ "os"
+
+ . "github.com/containers/podman/v2/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman pod create", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
+ podmanTest.SeedImages()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ processTestResult(f)
+
+ })
+
+ It("podman pod container share Namespaces", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "start", podID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--pod", podID, "-d", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.Namespaces.IPC}} {{.Namespaces.UTS}} {{.Namespaces.NET}}"})
+ check.WaitWithDefaultTimeout()
+ Expect(check.ExitCode()).To(Equal(0))
+ outputArray := check.OutputToStringArray()
+ Expect(len(outputArray)).To(Equal(2))
+
+ NAMESPACE1 := outputArray[0]
+ fmt.Println("NAMESPACE1:", NAMESPACE1)
+ NAMESPACE2 := outputArray[1]
+ fmt.Println("NAMESPACE2:", NAMESPACE2)
+ Expect(NAMESPACE1).To(Equal(NAMESPACE2))
+ })
+
+ It("podman pod container share ipc && /dev/shm ", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "start", podID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--pod", podID, ALPINE, "touch", "/dev/shm/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--pod", podID, ALPINE, "ls", "/dev/shm/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman pod container dontshare PIDNS", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "start", podID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--pod", podID, "-d", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.Namespaces.PIDNS}}"})
+ check.WaitWithDefaultTimeout()
+ Expect(check.ExitCode()).To(Equal(0))
+ outputArray := check.OutputToStringArray()
+ Expect(len(outputArray)).To(Equal(2))
+
+ NAMESPACE1 := outputArray[0]
+ fmt.Println("NAMESPACE1:", NAMESPACE1)
+ NAMESPACE2 := outputArray[1]
+ fmt.Println("NAMESPACE2:", NAMESPACE2)
+ Expect(NAMESPACE1).To(Not(Equal(NAMESPACE2)))
+ })
+
+})