mirror of
https://github.com/containers/podman.git
synced 2025-12-07 14:20:44 +08:00
Fix broken podman images filters
The id, digest, and intermediate filters were broken for podman images. Fix to match on substrings instead of the whole string for id and digest. Add the intermediate value correctly when set. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
@@ -118,6 +118,32 @@ var _ = Describe("Podman images", func() {
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman images filter by image ID", func() {
|
||||
session := podmanTest.Podman([]string{"inspect", ALPINE, "--format", "{{.ID}}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||
imgID := session.OutputToString()
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "--noheading", "--filter", "id=" + imgID[:5]})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman images filter by image digest", func() {
|
||||
session := podmanTest.Podman([]string{"inspect", ALPINE, "--format", "{{.Digest}}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||
imgDigest := session.OutputToString()
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "--noheading", "--filter", "digest=" + imgDigest[:10]})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman images filter reference", func() {
|
||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "reference=quay.io/libpod/*"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
@@ -195,6 +221,18 @@ WORKDIR /test
|
||||
Expect(result.OutputToStringArray()).Should(BeEmpty(), "dangling image output: %q", result.OutputToString())
|
||||
})
|
||||
|
||||
It("podman images filter intermediate", func() {
|
||||
dockerfile := `FROM quay.io/libpod/alpine:latest
|
||||
RUN touch /tmp/test.txt
|
||||
RUN touch /tmp/test-2.txt
|
||||
`
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/test-build", "true")
|
||||
result := podmanTest.Podman([]string{"images", "--noheading", "--filter", "intermediate=true"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman pull by digest and list --all", func() {
|
||||
// Prevent regressing on issue #7651: error parsing name that includes a digest
|
||||
// component as if were a name that includes tag component.
|
||||
|
||||
Reference in New Issue
Block a user