From ecae5f7adeb1acea9c090c3d6c43f7470f33ac84 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 16 Sep 2020 12:12:07 +0200 Subject: image list: return all associated names Always return all associated names / repo tags of an image and fix a bug with malformed repo tags. Previously, Podman returned all names only with `--all` but this flag only instructs to list intermediate images and should not alter associated names. With `--all` Podman queried the repo tags of an image which splits all *tagged* names into repository and tag which is then reassembled to eventually be parsed again in the frontend. Lot's of redundant CPU heat and buggy as the reassembly didn't consider digests which ultimately broke parsing in the frontend. Fixes: #7651 Signed-off-by: Valentin Rothberg --- test/e2e/images_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/e2e/images_test.go') diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index a615a9f99..ddf2e20b8 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -241,6 +241,38 @@ WORKDIR /test Expect(result.OutputToStringArray()).Should(HaveLen(0), "dangling image output: %q", result.OutputToString()) }) + It("podman pull by digest and list --all", func() { + // Prevent regressing on issue #7651. + digestPullAndList := func(noneTag bool) { + session := podmanTest.Podman([]string{"pull", ALPINEAMD64DIGEST}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + result := podmanTest.Podman([]string{"images", "--all", ALPINEAMD64DIGEST}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + + found, _ := result.GrepString("") + if noneTag { + Expect(found).To(BeTrue()) + } else { + Expect(found).To(BeFalse()) + } + } + // No "" tag as tagged alpine instances should be present. + session := podmanTest.Podman([]string{"pull", ALPINELISTTAG}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + digestPullAndList(false) + + // Now remove all images, re-pull by digest and check for the "" tag. + session = podmanTest.Podman([]string{"rmi", "-af"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + digestPullAndList(true) + }) + It("podman check for image with sha256: prefix", func() { session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf