mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
Merge pull request #18965 from edsantiago/foodevdir_begone
e2e: use parallel-safe /dev subdirectories
This commit is contained in:
@ -876,15 +876,17 @@ ENTRYPOINT ["sleep","99999"]
|
||||
|
||||
It("podman pod create --device", func() {
|
||||
SkipIfRootless("Cannot create devices in /dev in rootless mode")
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll("/dev/foodevdir")
|
||||
// path must be unique to this test, not used anywhere else
|
||||
devdir := "/dev/devdirpodcreate"
|
||||
Expect(os.MkdirAll(devdir, os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll(devdir)
|
||||
|
||||
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
|
||||
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
||||
mknod.WaitWithDefaultTimeout()
|
||||
Expect(mknod).Should(Exit(0))
|
||||
|
||||
podName := "testPod"
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--device", "/dev/foodevdir:/dev/bar", "--name", podName})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--device", devdir + ":/dev/bar", "--name", podName})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"run", "-q", "--pod", podName, ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
|
||||
|
@ -72,14 +72,16 @@ var _ = Describe("Podman run device", func() {
|
||||
|
||||
It("podman run device host device and container device parameter are directories", func() {
|
||||
SkipIfRootless("Cannot create devices in /dev in rootless mode")
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll("/dev/foodevdir")
|
||||
// path must be unique to this test, not used anywhere else
|
||||
devdir := "/dev/devdirrundevice"
|
||||
Expect(os.MkdirAll(devdir, os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll(devdir)
|
||||
|
||||
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
|
||||
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
||||
mknod.WaitWithDefaultTimeout()
|
||||
Expect(mknod).Should(Exit(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/foodevdir:/dev/bar", ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
|
||||
session := podmanTest.Podman([]string{"run", "-q", "--device", devdir + ":/dev/bar", ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(Equal("1:3"))
|
||||
|
@ -113,9 +113,12 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||
It("podman privileged should restart after host devices change", func() {
|
||||
containerName := "privileged-restart-test"
|
||||
SkipIfRootless("Cannot create devices in /dev in rootless mode")
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(Succeed())
|
||||
// path must be unique to this test, not used anywhere else
|
||||
devdir := "/dev/devdirprivrestart"
|
||||
Expect(os.MkdirAll(devdir, os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll(devdir)
|
||||
|
||||
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
|
||||
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
||||
mknod.WaitWithDefaultTimeout()
|
||||
Expect(mknod).Should(Exit(0))
|
||||
|
||||
@ -125,7 +128,7 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||
|
||||
deviceFiles := session.OutputToStringArray()
|
||||
|
||||
os.RemoveAll("/dev/foodevdir")
|
||||
os.RemoveAll(devdir)
|
||||
session = podmanTest.Podman([]string{"start", "--attach", containerName})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
Reference in New Issue
Block a user