summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/cdi/device.json14
-rw-r--r--test/e2e/generate_kube_test.go23
-rw-r--r--test/e2e/ps_test.go6
-rw-r--r--test/e2e/run_device_test.go19
4 files changed, 62 insertions, 0 deletions
diff --git a/test/e2e/cdi/device.json b/test/e2e/cdi/device.json
new file mode 100644
index 000000000..f49470c88
--- /dev/null
+++ b/test/e2e/cdi/device.json
@@ -0,0 +1,14 @@
+{
+ "cdiVersion": "0.2.0",
+ "kind": "vendor.com/device",
+ "devices": [
+ {
+ "name": "myKmsg",
+ "containerEdits": {
+ "mounts": [
+ {"hostPath": "/dev/kmsg", "containerPath": "/dev/kmsg1", "options": ["rw", "rprivate", "rbind"]}
+ ]
+ }
+ }
+ ]
+}
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"
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 37b6516c1..d5269f415 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -269,6 +269,12 @@ var _ = Describe("Podman ps", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(Equal(cid))
+
+ // Query by trunctated image name should not match ( should return empty output )
+ result = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "-a", "--filter", "ancestor=quay.io/libpod/alpi"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(result.OutputToString()).To(Equal(""))
})
It("podman ps id filter flag", func() {
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 5a32ed827..3137e3fe4 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -2,6 +2,7 @@ package integration
import (
"os"
+ "os/exec"
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
@@ -94,4 +95,22 @@ var _ = Describe("Podman run device", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman run CDI device test", func() {
+ SkipIfRootless("Rootless will not be able to create files/folders in /etc")
+ cdiDir := "/etc/cdi"
+ if _, err := os.Stat(cdiDir); os.IsNotExist(err) {
+ Expect(os.MkdirAll(cdiDir, os.ModePerm)).To(BeNil())
+ }
+ defer os.RemoveAll(cdiDir)
+
+ cmd := exec.Command("cp", "cdi/device.json", cdiDir)
+ err = cmd.Run()
+ Expect(err).To(BeNil())
+
+ session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "myKmsg", ALPINE, "ls", "--color=never", "/dev/kmsg1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal("/dev/kmsg1"))
+ })
})