mirror of https://github.com/containers/podman.git
Minor fix filtering images by label
Added test to avoid future regressions Fix #3163 Signed-off-by: Divyansh Kamboj <kambojdivyansh2000@gmail.com>
This commit is contained in:
parent
18a953918e
commit
c6f7066e77
|
@ -362,7 +362,7 @@ func CreateFilterFuncs(ctx context.Context, r *adapter.LocalRuntime, filters []s
|
||||||
var filterFuncs []imagefilters.ResultFilter
|
var filterFuncs []imagefilters.ResultFilter
|
||||||
for _, filter := range filters {
|
for _, filter := range filters {
|
||||||
splitFilter := strings.Split(filter, "=")
|
splitFilter := strings.Split(filter, "=")
|
||||||
if len(splitFilter) != 2 {
|
if len(splitFilter) < 2 {
|
||||||
return nil, errors.Errorf("invalid filter syntax %s", filter)
|
return nil, errors.Errorf("invalid filter syntax %s", filter)
|
||||||
}
|
}
|
||||||
switch splitFilter[0] {
|
switch splitFilter[0] {
|
||||||
|
|
|
@ -298,4 +298,17 @@ ENV foo=bar
|
||||||
Expect(session2.ExitCode()).To(Equal(0))
|
Expect(session2.ExitCode()).To(Equal(0))
|
||||||
Expect(len(session2.OutputToStringArray())).To(Equal(6))
|
Expect(len(session2.OutputToStringArray())).To(Equal(6))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman images filter by label", func() {
|
||||||
|
SkipIfRemote()
|
||||||
|
dockerfile := `FROM docker.io/library/alpine:latest
|
||||||
|
LABEL version="1.0"
|
||||||
|
LABEL "com.example.vendor"="Example Vendor"
|
||||||
|
`
|
||||||
|
podmanTest.BuildImage(dockerfile, "test", "true")
|
||||||
|
session := podmanTest.Podman([]string{"images", "-f", "label=version=1.0"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
Expect(len(session.OutputToStringArray())).To(Equal(2))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue