From 4929e37507b530cb1d0e92cfcd252b0abefb4f2f Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 19 Feb 2018 08:40:43 -0600 Subject: 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 Closes: #365 Approved by: mheon --- test/e2e/images_test.go | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'test/e2e/images_test.go') diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 4c7c93e4b..ecc0f2415 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -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)) + }) }) -- cgit v1.2.3-54-g00ecf