summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorflouthoc <flouthoc.git@gmail.com>2021-08-23 16:13:48 +0530
committerflouthoc <flouthoc.git@gmail.com>2021-08-26 14:14:14 +0530
commitd5507704e9de0a4c0835f66668985eaf67ab3a72 (patch)
treed0483c85300ccee5b600107580441cf26f48d350 /test/e2e
parent23f9565547ae2a6b0154e6913abf7f1232f0ece0 (diff)
downloadpodman-d5507704e9de0a4c0835f66668985eaf67ab3a72.tar.gz
podman-d5507704e9de0a4c0835f66668985eaf67ab3a72.tar.bz2
podman-d5507704e9de0a4c0835f66668985eaf67ab3a72.zip
volumes: Add volume import to allow importing contents on tar into volume
Following feature makes sure that users can load contents of external tarball into the podman volumes. Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/volume_create_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index d9c805f46..3be1486d8 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -79,6 +79,50 @@ var _ = Describe("Podman volume create", func() {
Expect(check.OutputToString()).To(ContainSubstring("hello"))
})
+ It("podman create and import volume", func() {
+ if podmanTest.RemoteTest {
+ Skip("Volume export check does not work with a remote client")
+ }
+
+ session := podmanTest.Podman([]string{"volume", "create", "my_vol"})
+ session.WaitWithDefaultTimeout()
+ volName := session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> " + "/data/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"volume", "export", volName, "--output=hello.tar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"volume", "create", "my_vol2"})
+ session.WaitWithDefaultTimeout()
+ volName = session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"volume", "import", "my_vol2", "hello.tar"})
+ session.WaitWithDefaultTimeout()
+ volName = session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"run", "--volume", "my_vol2:/data", ALPINE, "cat", "/data/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.OutputToString()).To(ContainSubstring("hello"))
+ })
+
+ It("podman import volume should fail", func() {
+ // try import on volume or source which does not exists
+ if podmanTest.RemoteTest {
+ Skip("Volume export check does not work with a remote client")
+ }
+
+ session := podmanTest.Podman([]string{"volume", "import", "notfound", "notfound.tar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
+ })
+
It("podman create volume with bad volume option", func() {
session := podmanTest.Podman([]string{"volume", "create", "--opt", "badOpt=bad"})
session.WaitWithDefaultTimeout()