Add since as valid filter option for volume subcommands

Adds support for `since` as a valid filter option for `podman volume ls`
and `podman volume prune`.

Implements: #19228
Initially suggested from: #19119

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
This commit is contained in:
Jake Correnti
2023-07-18 14:49:27 -04:00
parent f8eaec6f84
commit e55e128fcd
8 changed files with 98 additions and 18 deletions

View File

@@ -211,4 +211,34 @@ var _ = Describe("Podman volume ls", func() {
Expect(session.OutputToStringArray()).To(HaveLen(1))
Expect(session.OutputToStringArray()[0]).To(Equal(vol3Name))
})
It("podman ls volume with --filter since/after", func() {
vol1 := "vol1"
vol2 := "vol2"
vol3 := "vol3"
session := podmanTest.Podman([]string{"volume", "create", vol1})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", vol2})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", vol3})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "since=" + vol1})
session.WaitWithDefaultTimeout()
Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()[0]).To(Equal(vol2))
Expect(session.OutputToStringArray()[1]).To(Equal(vol3))
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "after=" + vol1})
session.WaitWithDefaultTimeout()
Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()[0]).To(Equal(vol2))
Expect(session.OutputToStringArray()[1]).To(Equal(vol3))
})
})