Skip to content

Tests: Replace all console-image flags with the PR image#1868

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
kyoto:tests-fix-console-image
Apr 24, 2026
Merged

Tests: Replace all console-image flags with the PR image#1868
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
kyoto:tests-fix-console-image

Conversation

@kyoto
Copy link
Copy Markdown
Member

@kyoto kyoto commented Apr 24, 2026

When running tests in CI, replace all console images with the image for the PR being tested. This ensures the PR image is always used regardless of the OCP version being used.

Made-with: Cursor

Summary by CodeRabbit

  • Tests
    • Improved test infrastructure for container configuration validation.

When running tests in CI, replace all console images with the image for
the PR being tested. This ensures the PR image is always used regardless
of the OCP version being used.

Made-with: Cursor
@kyoto kyoto added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 24, 2026
@openshift-ci openshift-ci Bot requested review from JoaoFula and joshuawilson April 24, 2026 03:16
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 24, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

The test file's CSV patching logic has been updated to detect the --console-image flag differently and rewrite its value using a new pattern, changing how the argument is matched and modified during test execution without requiring an existing equals sign.

Changes

Cohort / File(s) Summary
Test CSV Patching Logic
tests/tests/lightspeed-install.cy.ts
Updated console image CLI argument detection pattern to match --console-image flag without requiring = in the argument, and rewrite value by replacing suffix content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A flag is matched with newfound grace,
The equals sign need not find its place,
Console images dance in glowing test,
This gentle patch puts logic to the test! ✨

🚥 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 accurately reflects the main change: updating test logic to replace console-image flags with the PR image.
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
Copy link
Copy Markdown

openshift-ci Bot commented Apr 24, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

Copy link
Copy Markdown

@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

🤖 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/tests/lightspeed-install.cy.ts`:
- Around line 176-177: The current conditional using
arg.startsWith('--console-image') with arg.replace(/=.*/,
`=${Cypress.env('CONSOLE_IMAGE')}`) misses the case where arg is exactly
'--console-image'; update the logic in tests/tests/lightspeed-install.cy.ts (the
code handling each arg) to detect if arg === '--console-image' and return
`--console-image=${Cypress.env('CONSOLE_IMAGE')}`, otherwise perform the
existing replace to swap any existing value; this ensures the PR console image
is always injected whether the arg has an '=' or not.
🪄 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: 7ec034a2-bf22-476e-98e0-a886025525aa

📥 Commits

Reviewing files that changed from the base of the PR and between 470828a and 9d8bf1d.

📒 Files selected for processing (1)
  • tests/tests/lightspeed-install.cy.ts

Comment on lines +176 to +177
arg.startsWith('--console-image')
? arg.replace(/=.*/, `=${Cypress.env('CONSOLE_IMAGE')}`)
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 24, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Handle --console-image without =; current replacement can be a no-op.

When the arg is exactly --console-image, arg.replace(/=.*/, ...) does not inject the PR image. That means this path can still skip forcing the PR image.

Proposed fix
-                  (arg) =>
-                    arg.startsWith('--console-image')
-                      ? arg.replace(/=.*/, `=${Cypress.env('CONSOLE_IMAGE')}`)
-                      : arg,
+                  (arg) =>
+                    arg === '--console-image' || arg.startsWith('--console-image=')
+                      ? `--console-image=${Cypress.env('CONSOLE_IMAGE')}`
+                      : arg,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
arg.startsWith('--console-image')
? arg.replace(/=.*/, `=${Cypress.env('CONSOLE_IMAGE')}`)
(arg) =>
arg === '--console-image' || arg.startsWith('--console-image=')
? `--console-image=${Cypress.env('CONSOLE_IMAGE')}`
: arg,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/tests/lightspeed-install.cy.ts` around lines 176 - 177, The current
conditional using arg.startsWith('--console-image') with arg.replace(/=.*/,
`=${Cypress.env('CONSOLE_IMAGE')}`) misses the case where arg is exactly
'--console-image'; update the logic in tests/tests/lightspeed-install.cy.ts (the
code handling each arg) to detect if arg === '--console-image' and return
`--console-image=${Cypress.env('CONSOLE_IMAGE')}`, otherwise perform the
existing replace to swap any existing value; this ensures the PR console image
is always injected whether the arg has an '=' or not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We know that they all have the format --console-image.*=

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@kyoto, understood — since all --console-image args in the CSV are guaranteed to have an = (i.e., the format is always --console-image.*=), the arg.replace(/=.*/, ...) will always find a match and correctly substitute the PR image. My concern doesn't apply here. Thanks for the clarification!


📝 Learnings were identified and not saved (knowledge base disabled). Enable

@JoaoFula
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 24, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 5f0689d into openshift:main Apr 24, 2026
5 checks passed
@kyoto kyoto deleted the tests-fix-console-image branch April 24, 2026 06:38
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented Apr 24, 2026

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

@openshift-cherrypick-robot
Copy link
Copy Markdown

@kyoto: #1868 failed to apply on top of branch "pattern-fly-5":

Applying: Tests: Replace all console-image flags with the PR image
Using index info to reconstruct a base tree...
M	tests/tests/lightspeed-install.cy.ts
Falling back to patching base and 3-way merge...
Auto-merging tests/tests/lightspeed-install.cy.ts
CONFLICT (content): Merge conflict in tests/tests/lightspeed-install.cy.ts
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Tests: Replace all console-image flags with the PR image

Details

In response to this:

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

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.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@kyoto: new pull request created: #1869

Details

In response to this:

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

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.

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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants