Merge pull request #16243 from alexlarsson/volume-create-ignore

Add podman volume create --ignore
This commit is contained in:
OpenShift Merge Robot
2022-10-26 15:00:51 -04:00
committed by GitHub
11 changed files with 80 additions and 18 deletions

View File

@@ -1,8 +1,7 @@
## assert-key-is Unit RequiresMountsFor "%t/containers"
## assert-key-is Service Type oneshot
## assert-key-is Service RemainAfterExit yes
## assert-key-is Service ExecCondition '/usr/bin/bash -c "! /usr/bin/podman volume exists systemd-basic"'
## assert-key-is Service ExecStart "/usr/bin/podman volume create systemd-basic"
## assert-key-is Service ExecStart "/usr/bin/podman volume create --ignore systemd-basic"
## assert-key-is Service SyslogIdentifier "%N"
[Volume]

View File

@@ -58,6 +58,28 @@ var _ = Describe("Podman volume create", func() {
Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman create volume with existing name fails", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
})
It("podman create volume --ignore", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--ignore", "myvol"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(volName))
})
It("podman create and export volume", func() {
if podmanTest.RemoteTest {
Skip("Volume export check does not work with a remote client")