Skip to content

Commit 293edee

Browse files
Merge pull request #31250 from bfournie/iri-idms
AGENT-1527: Fix comparison of InternalReleaseImage to mirror
2 parents 76ed5a8 + 5ecd62a commit 293edee

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

test/extended/internalreleaseimage/helper.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,32 +92,40 @@ func (h *IRITestHelper) DeleteIRI() error {
9292
return h.McClientV1alpha1.InternalReleaseImages().Delete(context.Background(), IRIResourceName, metav1.DeleteOptions{})
9393
}
9494

95-
// VerifyIDMSConfigured verifies that the test image repo is present in the image-digest-mirror IDMS
95+
// VerifyIDMSConfigured verifies that the test image repo is present as a mirror in at least one IDMS
9696
func (h *IRITestHelper) VerifyIDMSConfigured(releaseImage string) {
9797
e2e.Logf("Verifying image repo is present in image-digest-mirror IDMS: %s", releaseImage)
9898

99-
// Get the specific IDMS created for NoRegistryClusterInstall
100-
idms, err := h.oc.AdminConfigClient().ConfigV1().ImageDigestMirrorSets().Get(context.Background(), "image-digest-mirror", metav1.GetOptions{})
101-
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get image-digest-mirror IDMS")
99+
// List all IDMS resources
100+
idmsList, err := h.oc.AdminConfigClient().ConfigV1().ImageDigestMirrorSets().List(context.Background(), metav1.ListOptions{})
101+
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to list ImageDigestMirrorSets")
102102

103-
// Extract the source from the release image (remove @sha256:... digest)
104-
// Example: "registry.ci.openshift.org/ocp/4.22-2026-03-27-160521@sha256:abc" -> "registry.ci.openshift.org/ocp/4.22-2026-03-27-160521"
103+
// Extract the repo from the release image (remove @sha256:... digest)
104+
// Example: "api-int.example.com:22625/openshift/release-images@sha256:abc" -> "api-int.example.com:22625/openshift/release-images"
105105
imageSource := strings.Split(releaseImage, "@")[0]
106106
e2e.Logf("Extracted image source: %s", imageSource)
107107

108-
// Verify that the image source is covered by at least one IDMS mirror
108+
// Verify that the image source is listed as a mirror in at least one IDMS
109109
foundMatch := false
110-
for _, mirrorSet := range idms.Spec.ImageDigestMirrors {
111-
// Check if this IDMS source matches our image source exactly
112-
if mirrorSet.Source == imageSource {
113-
o.Expect(mirrorSet.Mirrors).NotTo(o.BeEmpty(), "IDMS source %s should have at least one mirror", mirrorSet.Source)
114-
e2e.Logf("Found IDMS match: source %s -> mirrors %v", mirrorSet.Source, mirrorSet.Mirrors)
115-
foundMatch = true
110+
for _, idms := range idmsList.Items {
111+
for _, mirrorSet := range idms.Spec.ImageDigestMirrors {
112+
for _, mirror := range mirrorSet.Mirrors {
113+
if string(mirror) == imageSource {
114+
e2e.Logf("Found IDMS match in %s: source %s -> mirror %s", idms.Name, mirrorSet.Source, mirror)
115+
foundMatch = true
116+
break
117+
}
118+
}
119+
if foundMatch {
120+
break
121+
}
122+
}
123+
if foundMatch {
116124
break
117125
}
118126
}
119127

120-
o.Expect(foundMatch).To(o.BeTrue(), "Image source %s must be present in image-digest-mirror IDMS to ensure mirrored pull", imageSource)
128+
o.Expect(foundMatch).To(o.BeTrue(), "Image source %s must be present as a mirror in at least one IDMS to ensure mirrored pull", imageSource)
121129
e2e.Logf("Confirmed: test image repo is covered by IDMS, will be pulled from mirror registry")
122130
}
123131

0 commit comments

Comments
 (0)