Skip to content

tests: Use $RELATED_IMAGE_*#263

Merged
Jakob-Naucke merged 1 commit into
trusted-execution-clusters:mainfrom
Jakob-Naucke:tests-related-images
May 27, 2026
Merged

tests: Use $RELATED_IMAGE_*#263
Jakob-Naucke merged 1 commit into
trusted-execution-clusters:mainfrom
Jakob-Naucke:tests-related-images

Conversation

@Jakob-Naucke
Copy link
Copy Markdown
Contributor

@Jakob-Naucke Jakob-Naucke commented May 27, 2026

Allow tests to not follow the $REGISTRY/$IMAGE_NAME:$TAG format by introducing the $OPERATOR_IMAGE variable and using $RELATED_IMAGE for compute-pcrs etc., like operator does, when set.

Summary by Sourcery

Allow tests and operator code to use shared image environment variable constants and support overriding test images via OPERATOR_IMAGE and RELATED_IMAGE_* variables.

New Features:

  • Support overriding test operator and related component images via OPERATOR_IMAGE and RELATED_IMAGE_* environment variables.

Enhancements:

  • Introduce a shared images module exporting RELATED_IMAGE_* constants for use across the operator and tests.
  • Update operator image selection to use shared RELATED_IMAGE_* constants instead of hardcoded environment variable names.
  • Document the optional use of OPERATOR_IMAGE and RELATED_IMAGE_* variables in the test README.

Allow tests to not follow the $REGISTRY/$IMAGE_NAME:$TAG format by
introducing the $OPERATOR_IMAGE variable and using $RELATED_IMAGE for
compute-pcrs etc., like operator does, when set.

Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
@Jakob-Naucke Jakob-Naucke requested a review from alicefr May 27, 2026 12:26
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 27, 2026

Reviewer's Guide

This PR refactors how container images are configured for the operator and tests by introducing shared RELATED_IMAGE constants, allowing tests to use explicit OPERATOR_IMAGE and RELATED_IMAGE_* variables instead of strictly deriving images from REGISTRY/IMAGE_NAME:TAG, and aligning env var usage between operator and tests.

File-Level Changes

Change Details Files
Introduce shared constants module for RELATED_IMAGE environment variable names and use it in operator and tests.
  • Add new images module exporting RELATED_IMAGE_* string constants in the shared library.
  • Update operator main to import images::* and use RELATED_IMAGE_* constants instead of hardcoded env var name strings.
  • Update test utilities to import images::* so they can reuse RELATED_IMAGE_* constants.
lib/src/lib.rs
lib/src/images.rs
operator/src/main.rs
test_utils/src/lib.rs
Allow tests to override operator and related component images via OPERATOR_IMAGE and RELATED_IMAGE_* environment variables instead of assuming a fixed registry/repo:tag pattern.
  • Change test image construction to first read OPERATOR_IMAGE and RELATED_IMAGE_* env vars, falling back to the previous {repo}/{name}:{tag} defaults if unset.
  • Keep existing behavior if the new environment variables are not provided, ensuring backwards compatibility of tests.
test_utils/src/lib.rs
Document new test configuration environment variables.
  • Extend tests README to describe OPERATOR_IMAGE and RELATED_IMAGE_* as alternatives to REGISTRY-based configuration.
tests/README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider adding an OPERATOR_IMAGE constant to lib::images (similar to the RELATED_IMAGE_* ones) and using it in the tests instead of the hard-coded string to keep all image-related env var names centralized.
  • You may want to reuse the existing get_image_or_env helper in the test harness (or a small wrapper around it) so that image selection logic is consistent between the operator and tests and future changes only need to happen in one place.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding an `OPERATOR_IMAGE` constant to `lib::images` (similar to the `RELATED_IMAGE_*` ones) and using it in the tests instead of the hard-coded string to keep all image-related env var names centralized.
- You may want to reuse the existing `get_image_or_env` helper in the test harness (or a small wrapper around it) so that image selection logic is consistent between the operator and tests and future changes only need to happen in one place.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 27, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: alicefr, Jakob-Naucke

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

@Jakob-Naucke Jakob-Naucke merged commit d832576 into trusted-execution-clusters:main May 27, 2026
10 checks passed
@Jakob-Naucke Jakob-Naucke deleted the tests-related-images branch May 27, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants