From 703f84cbcfe8a7387f7e980441a8eac0f5564efb Mon Sep 17 00:00:00 2001 From: Yamunadevi Shanmugam Date: Wed, 13 May 2026 18:41:06 +0530 Subject: [PATCH 1/5] Fixed flakiness in oc debug image stream --- test/extended/cli/debug.go | 51 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/test/extended/cli/debug.go b/test/extended/cli/debug.go index 5969b0ef071f..6df9f99fb505 100644 --- a/test/extended/cli/debug.go +++ b/test/extended/cli/debug.go @@ -3,6 +3,7 @@ package cli import ( "context" "fmt" + "strings" "time" g "github.com/onsi/ginkgo/v2" @@ -15,7 +16,6 @@ import ( "k8s.io/klog/v2" admissionapi "k8s.io/pod-security-admission/api" - configv1 "github.com/openshift/api/config/v1" exutil "github.com/openshift/origin/test/extended/util" ) @@ -33,7 +33,6 @@ var _ = g.Describe("[sig-cli] oc debug", func() { testDeployment := exutil.FixturePath("testdata", "test-deployment.yaml") testReplicationController := exutil.FixturePath("testdata", "test-replication-controller.yaml") helloPod := exutil.FixturePath("..", "..", "examples", "hello-openshift", "hello-pod.json") - imageStreamsCentos := exutil.FixturePath("..", "..", "examples", "image-streams", "image-streams-centos7.json") g.It("deployment from a build [apigroup:image.openshift.io]", func() { projectName, err := oc.Run("project").Args("-q").Output() @@ -252,33 +251,41 @@ spec: }) g.It("ensure it works with image streams [apigroup:image.openshift.io]", func() { - hasImageRegistry, err := exutil.IsCapabilityEnabled(oc, configv1.ClusterVersionCapabilityImageRegistry) - o.Expect(err).NotTo(o.HaveOccurred()) - - err = oc.Run("create").Args("-f", imageStreamsCentos).Execute() - o.Expect(err).NotTo(o.HaveOccurred()) - err = wait.Poll(cliInterval, cliTimeout, func() (bool, error) { - err := oc.Run("get").Args("imagestreamtags", "wildfly:latest").Execute() - return err == nil, nil + ctx := context.Background() + const ( + targetIS = "cli" + targetNS = "openshift" + containerImage = `{.spec.containers[0].image}` + digestPullMatch = `^.+@sha256:[a-f0-9]{64}$` + ) + + g.By("waiting for the internal ImageStreamTag to be available") + err := wait.PollUntilContextTimeout(ctx, cliInterval, cliTimeout, true, func(ctx context.Context) (bool, error) { + if err := oc.AsAdmin().Run("get").Args("istag", targetIS+":latest", "-n", targetNS).Execute(); err != nil { + return false, nil + } + return true, nil }) - o.Expect(err).NotTo(o.HaveOccurred()) - - var out string - var resolvedImageMatcher = o.MatchRegexp("image:.*oc-debug-.*/wildfly@sha256") - if !hasImageRegistry { - resolvedImageMatcher = o.ContainSubstring("image: quay.io/wildfly/wildfly-centos7") + if err != nil { + g.Skip(fmt.Sprintf("openshift/%s:latest not observed within %s: %v", targetIS, cliTimeout, err)) } - out, err = oc.Run("debug").Args("istag/wildfly:latest", "-o", "yaml").Output() + g.By("verifying oc debug works with istag") + img, err := oc.AsAdmin().Run("debug").Args( + fmt.Sprintf("istag/%s:latest", targetIS), "-n", targetNS, "-o", "jsonpath="+containerImage, + ).Output() o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(out).To(resolvedImageMatcher) + o.Expect(strings.TrimSpace(img)).To(o.MatchRegexp(digestPullMatch), "debug pod should reference the ImageStreamTag by digest (any registry host)") - var sha string - sha, err = oc.Run("get").Args("istag/wildfly:latest", "--template", "{{ .image.metadata.name }}").Output() + g.By("verifying oc debug works with isimage (SHA-based lookup)") + sha, err := oc.AsAdmin().Run("get").Args("istag", targetIS+":latest", "-n", targetNS, "--template", "{{ .image.metadata.name }}").Output() o.Expect(err).NotTo(o.HaveOccurred()) - out, err = oc.Run("debug").Args(fmt.Sprintf("isimage/wildfly@%s", sha), "-o", "yaml").Output() + + img, err = oc.AsAdmin().Run("debug").Args( + fmt.Sprintf("isimage/%s@%s", targetIS, strings.TrimSpace(sha)), "-n", targetNS, "-o", "jsonpath="+containerImage, + ).Output() o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(out).To(o.ContainSubstring("image: quay.io/wildfly/wildfly-centos7")) + o.Expect(strings.TrimSpace(img)).To(o.MatchRegexp(digestPullMatch), "debug pod should reference the ImageStreamImage by digest (any registry host)") }) g.It("ensure that the label is set for node debug", func() { From 8c276e7151b31644fcbe604c11aedfba40d1658f Mon Sep 17 00:00:00 2001 From: Yamunadevi Shanmugam Date: Thu, 14 May 2026 13:59:14 +0530 Subject: [PATCH 2/5] remove the branch files --- test/extended/cli/debug.go | 51 ++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/test/extended/cli/debug.go b/test/extended/cli/debug.go index 6df9f99fb505..5969b0ef071f 100644 --- a/test/extended/cli/debug.go +++ b/test/extended/cli/debug.go @@ -3,7 +3,6 @@ package cli import ( "context" "fmt" - "strings" "time" g "github.com/onsi/ginkgo/v2" @@ -16,6 +15,7 @@ import ( "k8s.io/klog/v2" admissionapi "k8s.io/pod-security-admission/api" + configv1 "github.com/openshift/api/config/v1" exutil "github.com/openshift/origin/test/extended/util" ) @@ -33,6 +33,7 @@ var _ = g.Describe("[sig-cli] oc debug", func() { testDeployment := exutil.FixturePath("testdata", "test-deployment.yaml") testReplicationController := exutil.FixturePath("testdata", "test-replication-controller.yaml") helloPod := exutil.FixturePath("..", "..", "examples", "hello-openshift", "hello-pod.json") + imageStreamsCentos := exutil.FixturePath("..", "..", "examples", "image-streams", "image-streams-centos7.json") g.It("deployment from a build [apigroup:image.openshift.io]", func() { projectName, err := oc.Run("project").Args("-q").Output() @@ -251,41 +252,33 @@ spec: }) g.It("ensure it works with image streams [apigroup:image.openshift.io]", func() { - ctx := context.Background() - const ( - targetIS = "cli" - targetNS = "openshift" - containerImage = `{.spec.containers[0].image}` - digestPullMatch = `^.+@sha256:[a-f0-9]{64}$` - ) - - g.By("waiting for the internal ImageStreamTag to be available") - err := wait.PollUntilContextTimeout(ctx, cliInterval, cliTimeout, true, func(ctx context.Context) (bool, error) { - if err := oc.AsAdmin().Run("get").Args("istag", targetIS+":latest", "-n", targetNS).Execute(); err != nil { - return false, nil - } - return true, nil + hasImageRegistry, err := exutil.IsCapabilityEnabled(oc, configv1.ClusterVersionCapabilityImageRegistry) + o.Expect(err).NotTo(o.HaveOccurred()) + + err = oc.Run("create").Args("-f", imageStreamsCentos).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + err = wait.Poll(cliInterval, cliTimeout, func() (bool, error) { + err := oc.Run("get").Args("imagestreamtags", "wildfly:latest").Execute() + return err == nil, nil }) - if err != nil { - g.Skip(fmt.Sprintf("openshift/%s:latest not observed within %s: %v", targetIS, cliTimeout, err)) + o.Expect(err).NotTo(o.HaveOccurred()) + + var out string + var resolvedImageMatcher = o.MatchRegexp("image:.*oc-debug-.*/wildfly@sha256") + if !hasImageRegistry { + resolvedImageMatcher = o.ContainSubstring("image: quay.io/wildfly/wildfly-centos7") } - g.By("verifying oc debug works with istag") - img, err := oc.AsAdmin().Run("debug").Args( - fmt.Sprintf("istag/%s:latest", targetIS), "-n", targetNS, "-o", "jsonpath="+containerImage, - ).Output() + out, err = oc.Run("debug").Args("istag/wildfly:latest", "-o", "yaml").Output() o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(strings.TrimSpace(img)).To(o.MatchRegexp(digestPullMatch), "debug pod should reference the ImageStreamTag by digest (any registry host)") + o.Expect(out).To(resolvedImageMatcher) - g.By("verifying oc debug works with isimage (SHA-based lookup)") - sha, err := oc.AsAdmin().Run("get").Args("istag", targetIS+":latest", "-n", targetNS, "--template", "{{ .image.metadata.name }}").Output() + var sha string + sha, err = oc.Run("get").Args("istag/wildfly:latest", "--template", "{{ .image.metadata.name }}").Output() o.Expect(err).NotTo(o.HaveOccurred()) - - img, err = oc.AsAdmin().Run("debug").Args( - fmt.Sprintf("isimage/%s@%s", targetIS, strings.TrimSpace(sha)), "-n", targetNS, "-o", "jsonpath="+containerImage, - ).Output() + out, err = oc.Run("debug").Args(fmt.Sprintf("isimage/wildfly@%s", sha), "-o", "yaml").Output() o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(strings.TrimSpace(img)).To(o.MatchRegexp(digestPullMatch), "debug pod should reference the ImageStreamImage by digest (any registry host)") + o.Expect(out).To(o.ContainSubstring("image: quay.io/wildfly/wildfly-centos7")) }) g.It("ensure that the label is set for node debug", func() { From df066a493e1dbdb45da2d3fcdf1d25234dcb4601 Mon Sep 17 00:00:00 2001 From: Yamunadevi Shanmugam Date: Thu, 14 May 2026 15:48:07 +0530 Subject: [PATCH 3/5] fixed flakiness of oc image info --- test/extended/images/info.go | 48 +++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/test/extended/images/info.go b/test/extended/images/info.go index f860ff8612da..97cbfae423a2 100644 --- a/test/extended/images/info.go +++ b/test/extended/images/info.go @@ -2,11 +2,11 @@ package images import ( "context" + "strings" - "github.com/MakeNowJust/heredoc" g "github.com/onsi/ginkgo/v2" + o "github.com/onsi/gomega" - e2epod "k8s.io/kubernetes/test/e2e/framework/pod" admissionapi "k8s.io/pod-security-admission/api" exutil "github.com/openshift/origin/test/extended/util" @@ -28,16 +28,42 @@ var _ = g.Describe("[sig-imageregistry][Feature:ImageInfo] Image info", func() { g.It("should display information about images [apigroup:image.openshift.io]", func() { ns = oc.Namespace() - cli := e2epod.PodClientNS(oc.KubeFramework(), ns) - pod := cli.Create(context.TODO(), cliPodWithPullSecret(oc, heredoc.Docf(` - set -x + payloadImage, err := oc.AsAdmin().Run("get").Args("clusterversion", "version", "-o", "jsonpath={.status.desired.image}").Output() + o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get current payload image from clusterversion") + payloadImage = strings.TrimSpace(payloadImage) + o.Expect(payloadImage).NotTo(o.BeEmpty()) - # display info about an image on quay.io - oc image info quay.io/openshift-release-dev/ocp-release:4.18.3-x86_64 + var out string + cleanup, regArgs, prepErr := exutil.PrepareImagePullSecretAndCABundle(oc) + if cleanup != nil { + defer cleanup() + } - # display info about an image in json format - oc image info quay.io/openshift-release-dev/ocp-release:4.18.3-x86_64 -o json - `))) - cli.WaitForSuccess(context.TODO(), pod.Name, podStartupTimeout) + if prepErr == nil { + args := append([]string{"info", payloadImage}, regArgs...) + out, err = oc.AsAdmin().Run("image").Args(args...).Output() + } else { + err = prepErr + } + if err != nil { + ctx := context.Background() + isHyperShift, hsErr := exutil.IsHypershift(ctx, oc.AdminConfigClient()) + o.Expect(hsErr).NotTo(o.HaveOccurred()) + if isHyperShift { + g.Skip("Skipping on HyperShift: runner requires external outbound access to registry") + } + o.Expect(err).NotTo(o.HaveOccurred(), "oc image info failed on a standard cluster") + } + o.Expect(out).To(o.ContainSubstring("Digest:")) + o.Expect(out).To(o.MatchRegexp(`Name:\s+.*`)) + + //Test the json output + if prepErr == nil { + argsJson := append([]string{"info", payloadImage, "-o", "json"}, regArgs...) + outJson, errJson := oc.AsAdmin().Run("image").Args(argsJson...).Output() + o.Expect(errJson).NotTo(o.HaveOccurred()) + o.Expect(outJson).To(o.ContainSubstring(`"digest":`)) + o.Expect(outJson).To(o.MatchRegexp(`"name":\s+.*`)) + } }) }) From e3b87920ddb4af2862c73434c368d3cce301d1cb Mon Sep 17 00:00:00 2001 From: Yamunadevi Shanmugam Date: Thu, 14 May 2026 16:16:29 +0530 Subject: [PATCH 4/5] fixed review comments --- test/extended/images/info.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/extended/images/info.go b/test/extended/images/info.go index 97cbfae423a2..8826c4b47355 100644 --- a/test/extended/images/info.go +++ b/test/extended/images/info.go @@ -39,12 +39,13 @@ var _ = g.Describe("[sig-imageregistry][Feature:ImageInfo] Image info", func() { defer cleanup() } - if prepErr == nil { - args := append([]string{"info", payloadImage}, regArgs...) - out, err = oc.AsAdmin().Run("image").Args(args...).Output() - } else { - err = prepErr + if prepErr != nil { + o.Expect(prepErr).NotTo(o.HaveOccurred(), "Failed to prepare image pull secrets") } + + args := append([]string{"info", payloadImage}, regArgs...) + out, err = oc.AsAdmin().Run("image").Args(args...).Output() + if err != nil { ctx := context.Background() isHyperShift, hsErr := exutil.IsHypershift(ctx, oc.AdminConfigClient()) From 1591e24c70c9b9b8a42d58c84ef86970b4f8bba0 Mon Sep 17 00:00:00 2001 From: Yamunadevi Shanmugam Date: Thu, 14 May 2026 20:01:02 +0530 Subject: [PATCH 5/5] addressed the review comments --- test/extended/images/info.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/extended/images/info.go b/test/extended/images/info.go index 8826c4b47355..15b4ce04cd9b 100644 --- a/test/extended/images/info.go +++ b/test/extended/images/info.go @@ -59,12 +59,10 @@ var _ = g.Describe("[sig-imageregistry][Feature:ImageInfo] Image info", func() { o.Expect(out).To(o.MatchRegexp(`Name:\s+.*`)) //Test the json output - if prepErr == nil { - argsJson := append([]string{"info", payloadImage, "-o", "json"}, regArgs...) - outJson, errJson := oc.AsAdmin().Run("image").Args(argsJson...).Output() - o.Expect(errJson).NotTo(o.HaveOccurred()) - o.Expect(outJson).To(o.ContainSubstring(`"digest":`)) - o.Expect(outJson).To(o.MatchRegexp(`"name":\s+.*`)) - } + argsJson := append([]string{"info", payloadImage, "-o", "json"}, regArgs...) + outJson, errJson := oc.AsAdmin().Run("image").Args(argsJson...).Output() + o.Expect(errJson).NotTo(o.HaveOccurred()) + o.Expect(outJson).To(o.ContainSubstring(`"digest":`)) + o.Expect(outJson).To(o.MatchRegexp(`"name":\s+.*`)) }) })