Skip to content

Add release validation tests for image-references#2165

Open
Joeavaikath wants to merge 7 commits intoopenshift:oadp-devfrom
Joeavaikath:release-image-match-tests
Open

Add release validation tests for image-references#2165
Joeavaikath wants to merge 7 commits intoopenshift:oadp-devfrom
Joeavaikath:release-image-match-tests

Conversation

@Joeavaikath
Copy link
Copy Markdown
Contributor

@Joeavaikath Joeavaikath commented Apr 14, 2026

Why the changes were made

Adds automated validation that bundle/image-references stays in sync with the CSV on release branches:

  • Tag version check: Verifies every image tag uses the correct release version (e.g., :oadp-1.6 on the oadp-1.6 branch). Derives version from PULL_BASE_REF (Prow) or the git branch name.
  • CSV match check: Verifies every image in image-references has a corresponding RELATED_IMAGE_* env var in the CSV (or is a container image).
  • Exception support: Tag names can be added to an exceptions list for images with independent versioning (e.g., kubevirt plugins).

Both Prow-facing tests skip gracefully on non-release branches. The core validation logic is extracted into pure functions with comprehensive unit tests.

When tested against oadp-1.6, this already caught a real discrepancy: oadp-kubevirt-velero-plugin-rhel9 and oadp-kubevirt-datamover-plugin-rhel9 are in image-references but missing from the CSV's RELATED_IMAGE_* env vars.

How to test the changes made

# Run on oadp-dev (Prow-facing tests skip, unit tests run)
go test ./tests/release/ -v -count=1

# Run on a release branch to see real validation
git checkout oadp-1.6
go test ./tests/release/ -v -count=1

Summary by CodeRabbit

  • New Features

    • Add KubeVirt Datamover plugin image and expose it via RELATED_IMAGE_KUBEVIRT_DATAMOVER_PLUGIN (quay.io/konveyor/kubevirt-datamover-plugin:latest).
  • Chores

    • Add matching relatedImages entry to the operator bundle and expose the image in the manager deployment environment.
    • Promote YAML parsing library to a direct dependency.
  • Tests

    • Add comprehensive release validation tests and helpers to verify image-references, tag-version consistency, and CSV RELATED_IMAGE mappings.

Validates that bundle/image-references entries match CSV
RELATED_IMAGE_* env vars and use the correct release version
tag. Skips gracefully on non-release branches. Supports an
exceptions list for images with independent versioning.

Signed-off-by: Joseph <jvaikath@redhat.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds YAML-backed image-references validators and tests, adds RELATED_IMAGE_KUBEVIRT_DATAMOVER_PLUGIN to CSV and manager deployment, and moves gopkg.in/yaml.v3 to a direct go.mod requirement.

Changes

Cohort / File(s) Summary
Image reference validation & tests
tests/release/image_references.go, tests/release/image_references_test.go, tests/release/helpers_test.go, tests/release/types.go
New YAML models and three exported validators: ValidateImageReferencesTagVersion, ValidateImageReferencesMatchCSV, ValidateCSVMatchImageReferences. Adds unit and integration tests, plus test helpers and types for parsing image-references and CSV manifests.
Operator CSV (env & relatedImages)
bundle/manifests/oadp-operator.clusterserviceversion.yaml
Adds RELATED_IMAGE_KUBEVIRT_DATAMOVER_PLUGIN=quay.io/konveyor/kubevirt-datamover-plugin:latest to container env and a corresponding spec.relatedImages entry kubevirt-datamover-plugin.
Manager deployment config
config/manager/manager.yaml
Adds RELATED_IMAGE_KUBEVIRT_DATAMOVER_PLUGIN env var pointing to quay.io/konveyor/kubevirt-datamover-plugin:latest in the manager container.
Go module
go.mod
Promotes gopkg.in/yaml.v3 v3.0.1 from indirect to a direct requirement.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant TestRunner as Test Runner
participant Validator as ImageRefs Validator
participant ImageRefsFile as bundle/image-references.yaml
participant CSVFile as bundle/manifests/...csv
TestRunner->>Validator: invoke validation functions
Validator->>ImageRefsFile: parse image-references YAML
Validator->>CSVFile: parse CSV YAML
Validator->>Validator: extract tags, RELATED_IMAGE_* env vars, container images
Validator->>Validator: apply exceptions and compare tags ↔ expectedVersion / CSV values
Validator-->>TestRunner: return []error (validation results)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 8 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ❓ Inconclusive Custom check requirements are written for Ginkgo test patterns but PR contains standard Go tests using testing.T framework. Modify check to assess standard Go test quality criteria or clarify if Ginkgo-style tests were expected for this codebase.
✅ Passed checks (8 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main addition: automated validation tests for image-references consistency on release branches.
Description check ✅ Passed The description comprehensively covers both required sections: why the changes were made (explaining the three validation mechanisms and branch behavior) and how to test (with specific commands for both oadp-dev and release branches).
Stable And Deterministic Test Names ✅ Passed The PR uses the standard Go testing framework with static, deterministic test names that contain no dynamic information such as timestamps, UUIDs, or generated identifiers.
Microshift Test Compatibility ✅ Passed The custom check applies to Ginkgo e2e tests. This PR adds only standard Go unit tests using testing.T package, which are not Ginkgo tests and do not run against Kubernetes clusters.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds standard Go unit tests with inline test data for bundle manifest validation, not Ginkgo e2e tests. Tests do not interact with Kubernetes clusters or assume cluster topology.
Topology-Aware Scheduling Compatibility ✅ Passed Pull request introduces only environment variable and metadata additions with no scheduling constraints affecting alternative OpenShift topologies.
Ote Binary Stdout Contract ✅ Passed PR adds test files and utility functions exclusively under tests/release/ with no process-level code elements that could emit non-JSON content to stdout.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add Ginkgo e2e tests; it contains standard Go unit tests using the testing package, not Ginkgo constructs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Joeavaikath
Once this PR has been reviewed and has the lgtm label, please assign rayfordj for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Joeavaikath Joeavaikath requested a review from weshayutin April 14, 2026 03:26
@Joeavaikath
Copy link
Copy Markdown
Contributor Author

/cherry-pick oadp-1.6

@openshift-cherrypick-robot
Copy link
Copy Markdown
Contributor

@Joeavaikath: once the present PR merges, I will cherry-pick it on top of oadp-1.6 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick oadp-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@weshayutin
Copy link
Copy Markdown
Contributor

/retest

@weshayutin
Copy link
Copy Markdown
Contributor

on the oadp-1.6 branch

whayutin@fedora:~/OPENSHIFT/git/OADP/oadp-operator$ go test ./tests/release/ -v -count=1
=== RUN   TestImageReferencesTagVersion
--- PASS: TestImageReferencesTagVersion (0.00s)
=== RUN   TestImageReferencesMatchCSV
    image_references_test.go:94: image-references tag "oadp-kubevirt-velero-plugin-rhel9" has image "quay.io/konveyor/kubevirt-velero-plugin:oadp-1.6" which is not in CSV RELATED_IMAGE_* env vars
    image_references_test.go:94: image-references tag "oadp-kubevirt-datamover-plugin-rhel9" has image "quay.io/konveyor/kubevirt-datamover-plugin:oadp-1.6" which is not in CSV RELATED_IMAGE_* env vars
--- FAIL: TestImageReferencesMatchCSV (0.00s)
=== RUN   TestValidateImageReferencesMatchCSV

Signed-off-by: Joseph <jvaikath@redhat.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bundle/manifests/oadp-operator.clusterserviceversion.yaml`:
- Line 1706: There are two spec.relatedImages entries for the same name
"openshift-adp-controller-manager-kubevirt-velero-plugin" with different tags;
remove the duplicate so each spec.relatedImages.name maps to exactly one image.
Locate both entries named
"openshift-adp-controller-manager-kubevirt-velero-plugin" and keep the canonical
image tag (choose and retain the intended tag, e.g., ":oadp-1.6" or ":latest"),
delete the other entry, and ensure no other relatedImages contain the same name
to avoid ambiguous release metadata resolution.
- Around line 1483-1484: The CSV currently defines the environment variable
RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN twice; remove the duplicate entry so there
is a single env var declaration for RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN in the
container/env list, keeping the branch-appropriate image tag (the intended value
from the original declaration) and delete the redundant block (the second
occurrence shown in the diff) so deployment behavior is deterministic.

In `@config/manager/manager.yaml`:
- Around line 105-106: Remove the duplicate RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
environment variable entry and ensure only a single declaration remains; locate
the second occurrence of RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN in the
manager.yaml env list, delete that duplicate entry (or consolidate if the value
differs), and keep the authoritative value in the original
RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN declaration so the operator resolves a
single, deterministic plugin tag at runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d8a70d7-8fe8-425d-b60e-dfe65e25be28

📥 Commits

Reviewing files that changed from the base of the PR and between c48061c and 59ec707.

📒 Files selected for processing (3)
  • bundle/manifests/oadp-operator.clusterserviceversion.yaml
  • config/manager/manager.yaml
  • go.mod

Comment thread bundle/manifests/oadp-operator.clusterserviceversion.yaml Outdated
Comment thread bundle/manifests/oadp-operator.clusterserviceversion.yaml Outdated
Comment thread config/manager/manager.yaml Outdated
Comment on lines +105 to +106
- name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
value: quay.io/konveyor/kubevirt-velero-plugin:oadp-1.6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove duplicate RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN definition.

Line 105 introduces a second entry for the same env var already declared earlier (Line 83). This makes the effective value order-dependent and can cause the operator to resolve the wrong plugin tag at runtime.

Proposed fix
@@
-            - name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
-              value: quay.io/konveyor/kubevirt-velero-plugin:latest
+            - name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
+              value: quay.io/konveyor/kubevirt-velero-plugin:oadp-1.6
@@
-            - name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
-              value: quay.io/konveyor/kubevirt-velero-plugin:oadp-1.6
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/manager/manager.yaml` around lines 105 - 106, Remove the duplicate
RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN environment variable entry and ensure only
a single declaration remains; locate the second occurrence of
RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN in the manager.yaml env list, delete that
duplicate entry (or consolidate if the value differs), and keep the
authoritative value in the original RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN
declaration so the operator resolves a single, deterministic plugin tag at
runtime.

Comment thread bundle/manifests/oadp-operator.clusterserviceversion.yaml Outdated
Comment thread bundle/manifests/oadp-operator.clusterserviceversion.yaml
Signed-off-by: Joseph <jvaikath@redhat.com>
Comment thread bundle/manifests/oadp-operator.clusterserviceversion.yaml Outdated
Comment thread bundle/manifests/oadp-operator.clusterserviceversion.yaml Outdated
Comment thread config/manager/manager.yaml Outdated
Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Joseph <jvaikath@redhat.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/release/image_references_test.go (1)

23-37: Optional: extract shared bundle-loading setup into a tiny helper.

Line 24–27 and Line 32–35 duplicate the same setup; a small helper would reduce repetition in these top-level integration tests.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/release/image_references_test.go` around lines 23 - 37, Both tests
TestImageReferencesMatchCSV and TestCSVMatchImageReferences duplicate
bundle-loading setup (repoRoot, readBundleFile, imageRefsRelPath, csvRelPath);
extract that into a small helper function (e.g., loadImageAndCSV or
setupBundleData) that returns irData and csvData and call that helper from both
tests, then pass the returned values into
reportErrors(ValidateImageReferencesMatchCSV(...)) and
reportErrors(ValidateCSVMatchImageReferences(...)) to remove the repeated lines.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/release/helpers_test.go`:
- Around line 25-39: The branchVersion function currently treats any branch with
prefix oadpBranchPrefix (e.g., "oadp-dev") as a release branch and fatals on git
errors; update branch detection to only accept release-style names (for example
match a stricter pattern like start with oadp- followed by digits/semantic parts
or explicitly exclude "oadp-dev") when checking both the PULL_BASE_REF env var
and the git HEAD result, and change the git lookup error handling in
branchVersion (replace t.Fatalf) to return an empty string so tests gracefully
skip instead of failing; locate and modify the branchVersion function and its
uses of oadpBranchPrefix, the env var check, the branch variable check, and the
exec.Command error path accordingly.

---

Nitpick comments:
In `@tests/release/image_references_test.go`:
- Around line 23-37: Both tests TestImageReferencesMatchCSV and
TestCSVMatchImageReferences duplicate bundle-loading setup (repoRoot,
readBundleFile, imageRefsRelPath, csvRelPath); extract that into a small helper
function (e.g., loadImageAndCSV or setupBundleData) that returns irData and
csvData and call that helper from both tests, then pass the returned values into
reportErrors(ValidateImageReferencesMatchCSV(...)) and
reportErrors(ValidateCSVMatchImageReferences(...)) to remove the repeated lines.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: afd7ce6b-462a-4639-838a-2d6038579a0d

📥 Commits

Reviewing files that changed from the base of the PR and between c3e99ef and 3655e8a.

📒 Files selected for processing (4)
  • tests/release/helpers_test.go
  • tests/release/image_references.go
  • tests/release/image_references_test.go
  • tests/release/types.go
✅ Files skipped from review due to trivial changes (1)
  • tests/release/types.go

Comment thread tests/release/helpers_test.go
Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Joseph <jvaikath@redhat.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 15, 2026

@Joeavaikath: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.23-e2e-test-aws 99443bb link false /test 4.23-e2e-test-aws
ci/prow/4.22-e2e-test-aws 99443bb link true /test 4.22-e2e-test-aws
ci/prow/images 99443bb link true /test images

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants