Skip to content

clusterimageset-updater: mock release API in integration test - #5323

Open
psalajova wants to merge 4 commits into
openshift:mainfrom
psalajova:fix/clusterimageset-updater-mock-release-api
Open

clusterimageset-updater: mock release API in integration test#5323
psalajova wants to merge 4 commits into
openshift:mainfrom
psalajova:fix/clusterimageset-updater-mock-release-api

Conversation

@psalajova

@psalajova psalajova commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add --release-service-host to clusterimageset-updater for overriding the OCP release catalog endpoint
  • Run the integration suite against a local mock release server with a fixed pullspec (4.21.25-multi) instead of the live catalog
  • Document the fixture expectations in test/integration/clusterimageset-updater/README.md

Depends on #5322 (fixture bump to 4.21.25). Merge that first, then rebase this PR if needed.

Made with Cursor

Adds an optional --release-service-url CLI flag to clusterimageset-updater to override the OCP release service base URL used when resolving prerelease pullspecs. This allows CI integration tests (and operators) to point the updater at a local or alternate release catalog instead of the live service.

The release client code now supports resolving endpoints and pullspecs using the provided service URL while preserving the existing default behavior when the flag is unset. The clusterimageset-updater integration suite starts a mock release server and passes --release-service-url to ensure stable, catalog-independent results (mocking the pullspec to 4.21.25-multi); fixture expectations are documented under test/integration/clusterimageset-updater/README.md.

This PR depends on #5322 being merged first.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

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

Walkthrough

The updater accepts an optional release service URL and passes it through prerelease resolution. Candidate and prerelease endpoint helpers support overrides while retaining defaults. Integration tests now use a local mock release server and document the fixture-based workflow.

Changes

Release service URL override

Layer / File(s) Summary
Endpoint and prerelease resolution
pkg/release/candidate/client.go, pkg/release/prerelease/client.go, pkg/release/prerelease/client_test.go
Candidate and prerelease endpoint builders accept optional service URL overrides, with tests covering overridden and default endpoints.
CLI override wiring
cmd/clusterimageset-updater/main.go
The updater adds --release-service-url and passes it to prerelease pull-spec resolution.
Mock release service integration
test/integration/clusterimageset-updater.sh, test/integration/clusterimageset-updater/mock-release-server/main.go, test/integration/clusterimageset-updater/README.md
Integration tests start and clean up a local mock release server, use its published URL, and document fixture expectations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: lgtm

Suggested reviewers: danilo-gemoli, bear-redhat


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error ResolveReleaseCommon logs req.URL.String(); the new release-service override and test command echo can expose internal hostnames in logs. Redact the host before logging the release URL, and avoid printing the full --release-service-url value in test command output.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning mock-release-server listens on 127.0.0.1 and emits an IPv4-only URL, which breaks IPv6-only CI jobs. Bind the mock server to ::1 or a family-agnostic localhost/dual-stack listener and avoid hardcoded 127.0.0.1.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: clusterimageset-updater now uses a mocked release API in its integration test.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Go Error Handling ✅ Passed Touched Go code wraps errors with context and checks failures; no new panic, nil deref, or ignored error-return patterns were introduced.
Test Coverage For New Features ✅ Passed PASS: The new service-URL path has table-driven prerelease unit tests, and the integration suite exercises the updater against the mock release server.
Stable And Deterministic Test Names ✅ Passed No modified Ginkgo test titles contain dynamic data; the only added/changed test names are static t.Run subtest names.
Test Structure And Quality ✅ Passed No Ginkgo tests were changed; the added unit and shell integration tests have bounded waits, cleanup, and focused assertions.
Microshift Test Compatibility ✅ Passed PASS: No new Ginkgo e2e specs were added; the touched tests are a shell integration script, mock HTTP server, and unit tests, with no unsupported OpenShift API refs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the changes are shell integration and unit tests, so the SNO multi-node check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed No scheduling-affecting manifests or controllers changed; the PR only adds release URL plumbing and integration test/mock-server updates.
Ote Binary Stdout Contract ✅ Passed No OTE entrypoint gained stdout writes; the new stdout print is in a standalone mock-release-server helper, not the JSON-speaking test binary.
No-Weak-Crypto ✅ Passed Touched files only change release URL plumbing and test harnesses; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons found.
Container-Privileges ✅ Passed No changed PR-scoped file sets privileged, hostPID/Network/IPC, SYS_ADMIN, allowPrivilegeEscalation, or root-only securityContext.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: psalajova

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
pkg/release/candidate/client.go (1)

45-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document both exported service-host APIs completely.

  • pkg/release/candidate/client.go#L45-L50: add GoDoc describing the endpoint produced and empty-versus-overridden serviceHost behavior.
  • pkg/release/prerelease/client.go#L47-L55: document the client, prerelease, and serviceHost parameters and the returned pullspec/error.

As per coding guidelines, “Go documentation on Classes/Functions/Fields should be written properly.” As per path instructions, “Comment important exported functions with their purpose, parameters, and return values.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/release/candidate/client.go` around lines 45 - 50, Add complete GoDoc
comments to the exported EndpointWithServiceHost function in
pkg/release/candidate/client.go, describing the endpoint it builds and that an
empty serviceHost uses ServiceHost(d) while a non-empty value overrides it. Also
document the exported prerelease API in pkg/release/prerelease/client.go,
covering the client, prerelease, and serviceHost parameters and the returned
pullspec and error.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/integration/clusterimageset-updater.sh`:
- Around line 4-8: Update the Go mock startup flow around the command that
currently backgrounds go run: build the driver executable first, then background
that executable and assign its PID to mock_pid. Keep cleanup targeting mock_pid
so it reliably terminates the listener process.

---

Nitpick comments:
In `@pkg/release/candidate/client.go`:
- Around line 45-50: Add complete GoDoc comments to the exported
EndpointWithServiceHost function in pkg/release/candidate/client.go, describing
the endpoint it builds and that an empty serviceHost uses ServiceHost(d) while a
non-empty value overrides it. Also document the exported prerelease API in
pkg/release/prerelease/client.go, covering the client, prerelease, and
serviceHost parameters and the returned pullspec and error.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: c03542aa-f74e-4f1b-ba30-604520bea7cd

📥 Commits

Reviewing files that changed from the base of the PR and between 757a822 and fcb9d35.

📒 Files selected for processing (9)
  • cmd/clusterimageset-updater/main.go
  • pkg/release/candidate/client.go
  • pkg/release/prerelease/client.go
  • test/integration/clusterimageset-updater.sh
  • test/integration/clusterimageset-updater/README.md
  • test/integration/clusterimageset-updater/mock-release-server/main.go
  • test/integration/clusterimageset-updater/output/imagesets/ocp-release-4.21.25-multi-for-4.21.0-0-to-4.22.0-0_clusterimageset.yaml
  • test/integration/clusterimageset-updater/output/pools/4-21-20_clusterpool.yaml
  • test/integration/clusterimageset-updater/output/pools/4-21-auto_clusterpool.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/release (manual)
  • openshift/ci-docs (manual)
  • openshift/release-controller (manual)
  • openshift/ci-chat-bot (manual)

Comment thread test/integration/clusterimageset-updater.sh
@psalajova
psalajova force-pushed the fix/clusterimageset-updater-mock-release-api branch from fcb9d35 to feb5eac Compare July 21, 2026 07:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
pkg/release/prerelease/client.go (1)

51-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the exported resolver’s API contract.

ResolvePullSpecWithServiceURL is a new exported API, but its comment only states the purpose. Document client, prerelease, the empty/non-empty serviceURL behavior, and the returned pull spec/error.

Suggested documentation
-// ResolvePullSpecWithServiceURL resolves a pull spec, optionally overriding the release service URL.
+// ResolvePullSpecWithServiceURL resolves a pull spec for prerelease using client.
+// A non-empty serviceURL overrides the default release service endpoint.
+// It returns the resolved pull spec or an error.

As per path instructions, exported functions must document their purpose, parameters, and return values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/release/prerelease/client.go` around lines 51 - 52, Expand the GoDoc for
ResolvePullSpecWithServiceURL to document the client and prerelease inputs,
explain that an empty serviceURL uses the default while a non-empty value
overrides it, and describe the returned resolved pull spec and error.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/integration/clusterimageset-updater/mock-release-server/main.go`:
- Line 43: Update main to stop printing the release-server endpoint URL to
stdout, preserving stdout as JSON-only for OTE; publish the endpoint through a
ready-file or stderr instead, and update the corresponding launcher to read the
endpoint from that new channel.

---

Nitpick comments:
In `@pkg/release/prerelease/client.go`:
- Around line 51-52: Expand the GoDoc for ResolvePullSpecWithServiceURL to
document the client and prerelease inputs, explain that an empty serviceURL uses
the default while a non-empty value overrides it, and describe the returned
resolved pull spec and error.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 1f2e227d-abee-4de6-9806-f67ed576e9a6

📥 Commits

Reviewing files that changed from the base of the PR and between fcb9d35 and feb5eac.

📒 Files selected for processing (7)
  • cmd/clusterimageset-updater/main.go
  • pkg/release/candidate/client.go
  • pkg/release/prerelease/client.go
  • pkg/release/prerelease/client_test.go
  • test/integration/clusterimageset-updater.sh
  • test/integration/clusterimageset-updater/README.md
  • test/integration/clusterimageset-updater/mock-release-server/main.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/release (manual)
  • openshift/ci-docs (manual)
  • openshift/release-controller (manual)
  • openshift/ci-chat-bot (manual)
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/integration/clusterimageset-updater.sh
  • test/integration/clusterimageset-updater/README.md
  • pkg/release/candidate/client.go

@psalajova
psalajova force-pushed the fix/clusterimageset-updater-mock-release-api branch from feb5eac to 8231671 Compare July 21, 2026 07:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/integration/clusterimageset-updater/mock-release-server/main.go`:
- Line 56: Update the shutdown cleanup in main to handle the error returned by
server.Shutdown instead of discarding it. When shutdown fails, write the error
to stderr and terminate with a non-zero exit status; preserve the existing
successful shutdown behavior.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 61613d68-305c-41ba-b38d-cdb0622ef28f

📥 Commits

Reviewing files that changed from the base of the PR and between feb5eac and 8231671.

📒 Files selected for processing (7)
  • cmd/clusterimageset-updater/main.go
  • pkg/release/candidate/client.go
  • pkg/release/prerelease/client.go
  • pkg/release/prerelease/client_test.go
  • test/integration/clusterimageset-updater.sh
  • test/integration/clusterimageset-updater/README.md
  • test/integration/clusterimageset-updater/mock-release-server/main.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/release (manual)
  • openshift/ci-docs (manual)
  • openshift/release-controller (manual)
  • openshift/ci-chat-bot (manual)
🚧 Files skipped from review as they are similar to previous changes (6)
  • test/integration/clusterimageset-updater/README.md
  • test/integration/clusterimageset-updater.sh
  • pkg/release/prerelease/client_test.go
  • pkg/release/candidate/client.go
  • pkg/release/prerelease/client.go
  • cmd/clusterimageset-updater/main.go

Comment thread test/integration/clusterimageset-updater/mock-release-server/main.go Outdated
psalajova and others added 3 commits July 21, 2026 10:21
…ain.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy only input/output fixtures into the workdir and build the mock server
to mock-release-server-bin so it does not clash with the source directory.

Co-authored-by: Cursor <cursoragent@cursor.com>
os::cmd::expect_success requires an active junit suite. Build and start
the mock release server after declare_suite_start instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@psalajova: The following test 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/breaking-changes ebe1d25 link false /test breaking-changes

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.

@psalajova

Copy link
Copy Markdown
Contributor Author

/retest-required

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant