Merge pull request #10861 from jmguzik/until-prune-volume-cmd

Add prune until filter test for podman volume cli
This commit is contained in:
OpenShift Merge Robot 2021-07-27 14:50:24 +02:00 committed by GitHub
commit 508dc031c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 5 deletions

View File

@ -23,12 +23,8 @@ Do not prompt for confirmation.
Filter volumes to be pruned. Volumes can be filtered by the following attributes: Filter volumes to be pruned. Volumes can be filtered by the following attributes:
- dangling
- driver
- label - label
- name - until
- opt
- scope
#### **--help** #### **--help**

View File

@ -63,6 +63,37 @@ var _ = Describe("Podman volume prune", func() {
podmanTest.Cleanup() podmanTest.Cleanup()
}) })
It("podman prune volume --filter until", func() {
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=50"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=5000000000"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
podmanTest.Cleanup()
})
It("podman prune volume --filter", func() { It("podman prune volume --filter", func() {
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"}) session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()