Skip to content

WIP: Tests: Add wait for cluster API to become available#2102

Open
kyoto wants to merge 2 commits into
openshift:mainfrom
kyoto:tests-wait-for-cluster-api
Open

WIP: Tests: Add wait for cluster API to become available#2102
kyoto wants to merge 2 commits into
openshift:mainfrom
kyoto:tests-wait-for-cluster-api

Conversation

@kyoto

@kyoto kyoto commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Improved test initialization reliability by adding a preflight “cluster API reachable” gate before setup proceeds, retrying oc version up to 120 times with a 10-second delay, logging warnings on intermediate failures and re-throwing the final error if still unreachable.
    • Updated the test command helper to accept an optional timeout override (default remains 180,000ms), passing the value through to support more resilient test execution.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 18, 2026
@coderabbitai

coderabbitai Bot commented Jun 18, 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 oc test helper is extended with a configurable timeout parameter to support varied command execution durations. A new preflight gate is added to globalSetup that verifies cluster API reachability using a retry loop (120 attempts, 10-second delays) before test setup proceeds, logging intermediate warnings and a final error if the cluster API remains unreachable.

Changes

Cluster API Reachability Gate with Configurable Timeouts

Layer / File(s) Summary
Configurable timeout in oc helper
tests/support/fixtures.ts
The oc function signature is updated to accept an optional timeout parameter (defaulting to 180_000 milliseconds) and passes it through to execFileSync options, enabling shorter timeouts for specific invocations.
Cluster reachability retry loop
tests/support/global-setup.ts
A bounded retry loop (120 attempts with 10-second delays) is added at the start of globalSetup to confirm cluster API availability via oc(['version'], 10_000), logging warnings on failures and re-throwing the final error if the cluster API is never reached.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • JoaoFula
  • joshuawilson

Poem

🐇 With whiskers twitched and hope held high,
I check if APIs answer my cry.
One hundred twenty patient hops through time,
Each failure met with retry's rhyme.
When the cluster finally says "hello,"
Away we hop—the tests can go! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a wait mechanism for the cluster API to become available before test setup proceeds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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 openshift-ci Bot requested review from JoaoFula and syedriko June 18, 2026 02:37
@kyoto kyoto force-pushed the tests-wait-for-cluster-api branch from 6aab7ad to e41d0dd Compare June 18, 2026 04:28

@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 `@tests/support/global-setup.ts`:
- Around line 20-38: The global setup can block for approximately 95 minutes
when the cluster is unreachable because the oc function uses a 180-second
timeout per attempt, and with 30 retries at 10-second intervals, the failure
path takes too long. Add a per-attempt timeout parameter to the oc(['version'])
call to bound how long each probe waits, and reduce either MAX_RETRIES or
RETRY_DELAY_S (or both) to decrease the total wall time before CI fails when the
cluster is actually unavailable. This ensures the setup fails fast in failure
scenarios rather than blocking for extended periods.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 68bcdc6d-c0d7-4529-8003-5e06fcb2d61c

📥 Commits

Reviewing files that changed from the base of the PR and between 6aab7ad and e41d0dd.

📒 Files selected for processing (1)
  • tests/support/global-setup.ts

Comment thread tests/support/global-setup.ts
@kyoto kyoto force-pushed the tests-wait-for-cluster-api branch 3 times, most recently from 6a9e109 to 0f1360f Compare June 18, 2026 05:27
@kyoto kyoto force-pushed the tests-wait-for-cluster-api branch from 0f1360f to 0c2b81d Compare June 18, 2026 06:18
@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign joaofula 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

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant