aboutsummaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorMikhail Khachayants <tyler92@inbox.ru>2022-10-06 10:05:19 +0300
committerMikhail Khachayants <tyler92@inbox.ru>2022-10-06 15:37:36 +0300
commit8b189c0a0627e04578fe6591e61af850182b78be (patch)
treed80f22711bb0c29f53c606382e516b4d5971f772 /test/e2e
parent13a1c55d3f0d0cb9a34e865844278e935337cd1b (diff)
downloadpodman-8b189c0a0627e04578fe6591e61af850182b78be.tar.gz
podman-8b189c0a0627e04578fe6591e61af850182b78be.tar.bz2
podman-8b189c0a0627e04578fe6591e61af850182b78be.zip
Create full path to a directory when DirectoryOrCreate is used with play kube
Signed-off-by: Mikhail Khachayants <tyler92@inbox.ru>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/play_kube_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 8b9e43f65..97823e232 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2604,6 +2604,36 @@ spec:
Expect(st.Mode().IsDir()).To(Equal(true))
})
+ It("podman play kube test with DirectoryOrCreate HostPath type volume and non-existent directory path", func() {
+ hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2")
+
+ pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // the full path should have been created
+ st, err := os.Stat(hostPathLocation)
+ Expect(err).To(BeNil())
+ Expect(st.Mode().IsDir()).To(Equal(true))
+ })
+
+ It("podman play kube test with DirectoryOrCreate HostPath type volume and existent directory path", func() {
+ hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2")
+ Expect(os.MkdirAll(hostPathLocation, os.ModePerm)).To(BeNil())
+
+ pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+ })
+
It("podman play kube test with Socket HostPath type volume should fail if not socket", func() {
hostPathLocation := filepath.Join(tempdir, "file")
f, err := os.Create(hostPathLocation)