diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-07-28 10:25:14 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-07-28 10:27:44 -0400 |
commit | 6979d140f1c531fd32e885542be27407105ebf90 (patch) | |
tree | e2d8c286c22eb5fe4065fa957fe043b546ed8c52 /test/e2e/mount_test.go | |
parent | 288ebec6e737c105fa0ef43412de4e0a8997feb9 (diff) | |
download | podman-6979d140f1c531fd32e885542be27407105ebf90.tar.gz podman-6979d140f1c531fd32e885542be27407105ebf90.tar.bz2 podman-6979d140f1c531fd32e885542be27407105ebf90.zip |
Add podman image mount
There are many use cases where you want to just mount an image
without creating a container on it. For example you might want
to just examine the content in an image after you pull it for
security analysys. Or you might want to just use the executables
on the image without running it in a container.
The image is mounted readonly since we do not want people changing
images.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e/mount_test.go')
-rw-r--r-- | test/e2e/mount_test.go | 139 |
1 files changed, 139 insertions, 0 deletions
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("")) + }) }) |