mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
Fix handling of podman-remote build --device
Fixes: https://github.com/containers/podman/issues/10614 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -604,4 +604,38 @@ RUN echo hello`, ALPINE)
|
||||
Expect(inspect.OutputToString()).To(Equal("windows"))
|
||||
|
||||
})
|
||||
|
||||
It("podman build device test", func() {
|
||||
if _, err := os.Lstat("/dev/fuse"); err != nil {
|
||||
Skip(fmt.Sprintf("test requires stat /dev/fuse to work: %v", err))
|
||||
}
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
RUN ls /dev/fuse`, ALPINE)
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(125))
|
||||
|
||||
session = podmanTest.Podman([]string{"build", "--pull-never", "--device", "/dev/fuse", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman build device rename test", func() {
|
||||
SkipIfRootless("rootless builds do not currently support renaming devices")
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
RUN ls /dev/test1`, ALPINE)
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(125))
|
||||
|
||||
session = podmanTest.Podman([]string{"build", "--pull-never", "--device", "/dev/zero:/dev/test1", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user