summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCharlie Doern <cdoern@redhat.com>2022-06-21 15:41:10 -0400
committerCharlie Doern <cdoern@redhat.com>2022-06-22 16:52:16 -0400
commit2eda547dcd597a23ecc2311a7ceca46746a3026e (patch)
tree068c500c04fefe561f38f6d5232f4b0c8eaa636b /test
parent2382955c6a88e506ce6d85477c8c68bd24859bdd (diff)
downloadpodman-2eda547dcd597a23ecc2311a7ceca46746a3026e.tar.gz
podman-2eda547dcd597a23ecc2311a7ceca46746a3026e.tar.bz2
podman-2eda547dcd597a23ecc2311a7ceca46746a3026e.zip
podman run/create -v relative filepath support
podman currently does not support relative volume paths. Add parsing for relative paths in specgen, converting whatever volume was given to an absolute path. Signed-off-by: Charlie Doern <cdoern@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_volume_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index f31e62e42..edb657695 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -953,4 +953,32 @@ USER testuser`, fedoraMinimal)
Expect(volMount).Should(Exit(0))
Expect(volMount.OutputToString()).To(Equal("1000:1000"))
})
+
+ It("podman run -v with a relative dir", func() {
+ mountPath := filepath.Join(podmanTest.TempDir, "vol")
+ err = os.Mkdir(mountPath, 0755)
+ Expect(err).ToNot(HaveOccurred())
+ defer func() {
+ err := os.RemoveAll(mountPath)
+ Expect(err).ToNot(HaveOccurred())
+ }()
+
+ f, err := os.CreateTemp(mountPath, "podman")
+ Expect(err).ToNot(HaveOccurred())
+
+ cwd, err := os.Getwd()
+ Expect(err).ToNot(HaveOccurred())
+
+ err = os.Chdir(mountPath)
+ Expect(err).ToNot(HaveOccurred())
+ defer func() {
+ err := os.Chdir(cwd)
+ Expect(err).ToNot(HaveOccurred())
+ }()
+
+ run := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=disable", "-v", "./:" + dest, ALPINE, "ls", dest})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+ Expect(run.OutputToString()).Should(ContainSubstring(strings.TrimLeft("/vol/", f.Name())))
+ })
})