Skip to content

OCPBUGS-83532: Fix race condition in CRD Cypress test#16288

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
rhamilto:OCPBUGS-83532
Apr 15, 2026
Merged

OCPBUGS-83532: Fix race condition in CRD Cypress test#16288
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
rhamilto:OCPBUGS-83532

Conversation

@rhamilto
Copy link
Copy Markdown
Member

@rhamilto rhamilto commented Apr 15, 2026

Summary

  • Fixes intermittent test failures in customresourcedefinition.cy.ts
  • Adds URL validation and page load synchronization after navigation

Problem

The test was failing intermittently because it attempted to click the "Create YAML" button immediately after clicking "View instances" in the kebab menu, without waiting for:

  1. Navigation to complete to the instances page
  2. The page to fully load and render

This created a race condition where the button might not exist yet when Cypress tried to interact with it.

Solution

Added two synchronization points after the clickKebabAction call:

  1. cy.url().should('include', ...) - Ensures navigation completed to the correct URL
  2. listPage.isCreateButtonVisible() - Ensures the page loaded and the Create button exists

Test plan

  • Run the test multiple times to verify it no longer flakes: cd frontend && yarn test:cypress --spec 'packages/integration-tests/tests/crud/customresourcedefinition.cy.ts'
  • Verify CI passes
  • Consider auditing other tests using clickKebabAction for similar race conditions

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved test coverage for CustomResourceDefinition instance navigation and visibility checks.

The customresourcedefinition.cy.ts test was failing intermittently
due to a race condition. After clicking "View instances" via the
kebab menu, the test immediately attempted to click the "Create YAML"
button without waiting for navigation to complete.

This fix adds two synchronization points:
1. URL validation to ensure navigation completed
2. Page load check to ensure the Create button is visible

This eliminates the race condition and stabilizes the test.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-83532, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.23.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • Fixes intermittent test failures in customresourcedefinition.cy.ts
  • Adds URL validation and page load synchronization after navigation

Problem

The test was failing intermittently because it attempted to click the "Create YAML" button immediately after clicking "View instances" in the kebab menu, without waiting for:

  1. Navigation to complete to the instances page
  2. The page to fully load and render

This created a race condition where the button might not exist yet when Cypress tried to interact with it.

Solution

Added two synchronization points after the clickKebabAction call:

  1. cy.url().should('include', ...) - Ensures navigation completed to the correct URL
  2. listPage.isCreateButtonVisible() - Ensures the page loaded and the Create button exists

Test plan

  • Run the test multiple times to verify it no longer flakes: cd frontend && yarn test:cypress --spec 'packages/integration-tests/tests/crud/customresourcedefinition.cy.ts'
  • Verify CI passes
  • Consider auditing other tests using clickKebabAction for similar race conditions

🤖 Generated with Claude Code

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from Leo6Leo and cajieh April 15, 2026 15:12
@openshift-ci openshift-ci bot added kind/cypress Related to Cypress e2e integration testing approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 15, 2026
Copy link
Copy Markdown
Member

@logonoff logonoff left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 15, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff, rhamilto

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

@rhamilto
Copy link
Copy Markdown
Member Author

/cherry-pick release-4.22

@openshift-cherrypick-robot
Copy link
Copy Markdown

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

Details

In response to this:

/cherry-pick release-4.22

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 4e582f16-209b-4bb1-b278-cf9de2d6391f

📥 Commits

Reviewing files that changed from the base of the PR and between 6a8db8b and ef21f79.

📒 Files selected for processing (1)
  • frontend/packages/integration-tests/tests/crud/customresourcedefinition.cy.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/packages/integration-tests/tests/crud/customresourcedefinition.cy.ts
🔇 Additional comments (1)
frontend/packages/integration-tests/tests/crud/customresourcedefinition.cy.ts (1)

102-103: Good synchronization guard for flaky navigation path

This is a solid fix: waiting for the expected URL and then for the Create button to be visible makes the test flow deterministic before interacting with the next page.


📝 Walkthrough

Walkthrough

This change modifies the CustomResourceDefinition CRUD test to add validation during the "View instances" navigation flow. Specifically, the test now asserts that the browser URL matches the expected pattern before proceeding, and includes a visibility check for the create button on the list page. These additions serve as intermediate validation checkpoints in the existing test flow without altering any production code or public API contracts.

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

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

@rhamilto
Copy link
Copy Markdown
Member Author

/retest

@rhamilto
Copy link
Copy Markdown
Member Author

/jira refresh
/cherry-pick release-4.23 release-4.22

@openshift-cherrypick-robot
Copy link
Copy Markdown

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

Details

In response to this:

/jira refresh
/cherry-pick release-4.23 release-4.22

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-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-83532, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh
/cherry-pick release-4.23 release-4.22

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 openshift-eng/jira-lifecycle-plugin repository.

@rhamilto
Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-gcp-console
/verified by @rhamilto

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@rhamilto: This PR has been marked as verified by @rhamilto.

Details

In response to this:

/override ci/prow/e2e-gcp-console
/verified by @rhamilto

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

@rhamilto: Overrode contexts on behalf of rhamilto: ci/prow/e2e-gcp-console

Details

In response to this:

/override ci/prow/e2e-gcp-console
/verified by @rhamilto

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-merge-bot openshift-merge-bot bot merged commit 21203fa into openshift:main Apr 15, 2026
8 checks passed
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@rhamilto: Jira Issue Verification Checks: Jira Issue OCPBUGS-83532
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-83532 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Summary

  • Fixes intermittent test failures in customresourcedefinition.cy.ts
  • Adds URL validation and page load synchronization after navigation

Problem

The test was failing intermittently because it attempted to click the "Create YAML" button immediately after clicking "View instances" in the kebab menu, without waiting for:

  1. Navigation to complete to the instances page
  2. The page to fully load and render

This created a race condition where the button might not exist yet when Cypress tried to interact with it.

Solution

Added two synchronization points after the clickKebabAction call:

  1. cy.url().should('include', ...) - Ensures navigation completed to the correct URL
  2. listPage.isCreateButtonVisible() - Ensures the page loaded and the Create button exists

Test plan

  • Run the test multiple times to verify it no longer flakes: cd frontend && yarn test:cypress --spec 'packages/integration-tests/tests/crud/customresourcedefinition.cy.ts'
  • Verify CI passes
  • Consider auditing other tests using clickKebabAction for similar race conditions

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
  • Improved test coverage for CustomResourceDefinition instance navigation and visibility checks.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

@rhamilto: all tests passed!

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.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@rhamilto: new pull request created: #16290

Details

In response to this:

/cherry-pick release-4.22

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

@rhamilto: new pull request created: #16291

Details

In response to this:

/jira refresh
/cherry-pick release-4.23 release-4.22

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. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants