summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-27 06:08:22 -0400
committerGitHub <noreply@github.com>2021-04-27 06:08:22 -0400
commit5baa0ae85e5e6f0c3a35f7043b298f39f80aafc1 (patch)
treed8683d9bd1268f52dbd6e1a8115b17ca134baada /test
parente6fc34b71aa9d876b1218efe90e14f8b912b0603 (diff)
parent3bf0fbf6f6159107c0a2a120ee9f381675af53c0 (diff)
downloadpodman-5baa0ae85e5e6f0c3a35f7043b298f39f80aafc1.tar.gz
podman-5baa0ae85e5e6f0c3a35f7043b298f39f80aafc1.tar.bz2
podman-5baa0ae85e5e6f0c3a35f7043b298f39f80aafc1.zip
Merge pull request #10136 from zhangguanzhang/generate-kube-volume
Fixes generate kube incorrect when bind-mounting "/" and "/root"
Diffstat (limited to 'test')
-rw-r--r--test/e2e/generate_kube_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index c3586d9b6..611e8ddac 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -496,6 +496,29 @@ var _ = Describe("Podman generate kube", func() {
Expect(inspect.OutputToString()).To(ContainSubstring(vol1))
})
+ It("podman generate kube when bind-mounting '/' and '/root' at the same time ", func() {
+ // Fixes https://github.com/containers/podman/issues/9764
+
+ ctrName := "mount-root-ctr"
+ session1 := podmanTest.Podman([]string{"run", "-d", "--pod", "new:mount-root-conflict", "--name", ctrName,
+ "-v", "/:/volume1/",
+ "-v", "/root:/volume2/",
+ "alpine", "top"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", "mount-root-conflict"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ Expect(len(pod.Spec.Volumes)).To(Equal(2))
+
+ })
+
It("podman generate kube with persistent volume claim", func() {
vol := "vol-test-persistent-volume-claim"