mirror of
https://github.com/containers/podman.git
synced 2025-10-25 10:16:43 +08:00
Performance enhancement for podman images
Previous code was using slow routines to collect some of the information needed to output images. Specifically size was being calculated instead of using the cached, already known size already available. Also, straight- lined several of the code paths. Overall assessment is that these improvements cut the time for images in half. Signed-off-by: baude <bbaude@redhat.com> Closes: #365 Approved by: mheon
This commit is contained in:
@ -37,6 +37,15 @@ var _ = Describe("Podman images", func() {
|
||||
Expect(session.LineInOuputStartsWith("docker.io/library/busybox")).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman images with digests", func() {
|
||||
session := podmanTest.Podman([]string{"images", "--digests"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
|
||||
Expect(session.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue())
|
||||
Expect(session.LineInOuputStartsWith("docker.io/library/busybox")).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman images in JSON format", func() {
|
||||
session := podmanTest.Podman([]string{"images", "--format=json"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -44,10 +53,58 @@ var _ = Describe("Podman images", func() {
|
||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman images in GO template format", func() {
|
||||
session := podmanTest.Podman([]string{"images", "--format={{.ID}}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman images with short options", func() {
|
||||
session := podmanTest.Podman([]string{"images", "-qn"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 1))
|
||||
})
|
||||
|
||||
It("podman images filter by image name", func() {
|
||||
session := podmanTest.Podman([]string{"images", "-q", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(len(session.OutputToStringArray())).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman images filter before image", func() {
|
||||
dockerfile := `FROM docker.io/library/alpine:latest
|
||||
`
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest")
|
||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "before=foobar.com/before:latest"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(len(result.OutputToStringArray())).To(Equal(2))
|
||||
})
|
||||
|
||||
It("podman images filter after image", func() {
|
||||
rmi := podmanTest.Podman([]string{"rmi", "busybox"})
|
||||
rmi.WaitWithDefaultTimeout()
|
||||
Expect(rmi.ExitCode()).To(Equal(0))
|
||||
|
||||
dockerfile := `FROM docker.io/library/alpine:latest
|
||||
`
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest")
|
||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "after=docker.io/library/alpine:latest"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(len(result.OutputToStringArray())).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman images filter dangling", func() {
|
||||
dockerfile := `FROM docker.io/library/alpine:latest
|
||||
`
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest")
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest")
|
||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "dangling=true"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(len(result.OutputToStringArray())).To(Equal(1))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user