summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-06-11 15:27:42 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-09 19:30:03 +0000
commit4855998f1cf533b27e48b2ded5541841fe6a3ea6 (patch)
tree7bb7e276e04f7d235e667bf088e5c87e43a74924 /test
parentc7424b69911222c2dc92a41308685f1e6d36fb53 (diff)
downloadpodman-4855998f1cf533b27e48b2ded5541841fe6a3ea6.tar.gz
podman-4855998f1cf533b27e48b2ded5541841fe6a3ea6.tar.bz2
podman-4855998f1cf533b27e48b2ded5541841fe6a3ea6.zip
Add --volumes-from flag to podman run and create
podman now supports --volumes-from flag, which allows users to add all the volumes an existing container has to a new one. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #931 Approved by: mheon
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index dc087f700..32206c4f5 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -510,4 +510,41 @@ USER mail`
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman run --volumes-from flag", func() {
+ vol := filepath.Join(podmanTest.TempDir, "vol-test")
+ err := os.MkdirAll(vol, 0755)
+ Expect(err).To(BeNil())
+
+ volFile := filepath.Join(vol, "test.txt")
+ data := "Testing --volumes-from!!!"
+ err = ioutil.WriteFile(volFile, []byte(data), 0755)
+ Expect(err).To(BeNil())
+
+ session := podmanTest.Podman([]string{"create", "--volume", vol + ":/myvol", "docker.io/library/redis:alpine", "sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ ctrID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "echo", "'testing read-write!' >> myvol/test.txt"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":z", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman run --volumes-from flag with built-in volumes", func() {
+ session := podmanTest.Podman([]string{"create", "docker.io/library/redis:alpine", "sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ ctrID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("data"))
+
+ })
})