diff options
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/mount_rootless_test.go | 21 | ||||
-rw-r--r-- | test/e2e/mount_test.go | 139 | ||||
-rw-r--r-- | test/e2e/run_ns_test.go | 31 | ||||
-rw-r--r-- | test/e2e/untag_test.go | 10 |
4 files changed, 200 insertions, 1 deletions
diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go index ec7a573cb..312258532 100644 --- a/test/e2e/mount_rootless_test.go +++ b/test/e2e/mount_rootless_test.go @@ -59,4 +59,25 @@ var _ = Describe("Podman mount", func() { session.WaitWithDefaultTimeout() Expect(setup.ExitCode()).To(Equal(0)) }) + + It("podman image mount", func() { + setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + mount := podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).ToNot(Equal(0)) + Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare")) + }) + + It("podman unshare image podman mount", func() { + setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"unshare", PODMAN_BINARY, "image", "mount", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + }) }) diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go index 0749a34f2..a2b448337 100644 --- a/test/e2e/mount_test.go +++ b/test/e2e/mount_test.go @@ -282,4 +282,143 @@ var _ = Describe("Podman mount", func() { umount.WaitWithDefaultTimeout() Expect(umount.ExitCode()).To(Equal(0)) }) + + It("podman image mount", func() { + setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + images := podmanTest.PodmanNoCache([]string{"images"}) + images.WaitWithDefaultTimeout() + Expect(images.ExitCode()).To(Equal(0)) + + mount := podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + + umount := podmanTest.PodmanNoCache([]string{"image", "umount", ALPINE}) + umount.WaitWithDefaultTimeout() + Expect(umount.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(Equal("")) + + // Mount multiple times + mount = podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + + // Unmount once + mount = podmanTest.PodmanNoCache([]string{"image", "mount", ALPINE}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(ContainSubstring(ALPINE)) + + mount = podmanTest.PodmanNoCache([]string{"image", "umount", "--all"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + }) + + It("podman mount with json format", func() { + setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + mount := podmanTest.PodmanNoCache([]string{"image", "mount", fedoraMinimal}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + + j := podmanTest.PodmanNoCache([]string{"image", "mount", "--format=json"}) + j.WaitWithDefaultTimeout() + Expect(j.ExitCode()).To(Equal(0)) + Expect(j.IsJSONOutputValid()).To(BeTrue()) + + umount := podmanTest.PodmanNoCache([]string{"image", "umount", fedoraMinimal}) + umount.WaitWithDefaultTimeout() + Expect(umount.ExitCode()).To(Equal(0)) + }) + + It("podman mount many", func() { + setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.PodmanNoCache([]string{"pull", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.PodmanNoCache([]string{"pull", "busybox"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + mount1 := podmanTest.PodmanNoCache([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"}) + mount1.WaitWithDefaultTimeout() + Expect(mount1.ExitCode()).To(Equal(0)) + + umount := podmanTest.PodmanNoCache([]string{"image", "umount", fedoraMinimal, ALPINE}) + umount.WaitWithDefaultTimeout() + Expect(umount.ExitCode()).To(Equal(0)) + + mount := podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(ContainSubstring("busybox")) + + mount1 = podmanTest.PodmanNoCache([]string{"image", "unmount", "busybox"}) + mount1.WaitWithDefaultTimeout() + Expect(mount1.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(Equal("")) + + mount1 = podmanTest.PodmanNoCache([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"}) + mount1.WaitWithDefaultTimeout() + Expect(mount1.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(ContainSubstring(fedoraMinimal)) + Expect(mount.OutputToString()).To(ContainSubstring(ALPINE)) + + umount = podmanTest.PodmanNoCache([]string{"image", "umount", "--all"}) + umount.WaitWithDefaultTimeout() + Expect(umount.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(Equal("")) + + mount1 = podmanTest.PodmanNoCache([]string{"image", "mount", "--all"}) + mount1.WaitWithDefaultTimeout() + Expect(mount1.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(ContainSubstring(fedoraMinimal)) + Expect(mount.OutputToString()).To(ContainSubstring(ALPINE)) + + umount = podmanTest.PodmanNoCache([]string{"image", "umount", "--all"}) + umount.WaitWithDefaultTimeout() + Expect(umount.ExitCode()).To(Equal(0)) + + mount = podmanTest.PodmanNoCache([]string{"image", "mount"}) + mount.WaitWithDefaultTimeout() + Expect(mount.ExitCode()).To(Equal(0)) + Expect(mount.OutputToString()).To(Equal("")) + }) }) 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)) + }) + }) diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go index 50da76f7c..4e6dd6462 100644 --- a/test/e2e/untag_test.go +++ b/test/e2e/untag_test.go @@ -33,7 +33,11 @@ var _ = Describe("Podman untag", func() { }) It("podman untag all", func() { - Skip(v2remotefail) + SkipIfRemote() + setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + tags := []string{ALPINE, "registry.com/foo:bar", "localhost/foo:bar"} cmd := []string{"tag"} @@ -63,6 +67,10 @@ var _ = Describe("Podman untag", func() { }) It("podman tag/untag - tag normalization", func() { + setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + tests := []struct { tag, normalized string }{ |