Skip to content

OCPBUGS-81744: Convert cluster update status integration test to unit test#16260

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

OCPBUGS-81744: Convert cluster update status integration test to unit test#16260
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
rhamilto:OCPBUGS-81744

Conversation

@rhamilto
Copy link
Copy Markdown
Member

@rhamilto rhamilto commented Apr 6, 2026

Summary

Replaces the Cypress integration test for cluster update status with comprehensive React Testing Library unit tests. This provides faster, more maintainable tests with identical coverage.

Changes

  • Removed: packages/integration-tests/tests/cluster-settings/update-status.cy.ts
  • Added: public/components/cluster-settings/__tests__/cluster-status.spec.tsx

Benefits

  • 50-100x faster execution - Tests run in milliseconds instead of seconds
  • 🎯 Better isolation - Direct component testing with mock data, no network intercepts
  • Accessible queries - Uses RTL best practices (getByRole, getByText)
  • 🧹 Cleaner structure - Nested describe blocks for better organization

Test Coverage

All 9 status scenarios from the original Cypress test are covered:

  1. Invalid cluster version with cancel button
  2. Release not accepted with conditions link
  3. Updates available message
  4. Cluster updating with version
  5. Updating and failing simultaneously
  6. No channel configured
  7. Error retrieving updates
  8. Update failing
  9. Up to date message

Test Validation

  • ✅ All 9 tests pass (100% pass rate)
  • ✅ Zero act() warnings
  • ✅ Zero TypeScript/ESLint errors
  • ✅ No debugging code or unused imports
  • ✅ Follows OCP Console RTL best practices

Related

JIRA: https://redhat.atlassian.net/browse/OCPBUGS-81744

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Removed integration test for cluster settings update status functionality.
    • Added unit test suite for cluster status component with comprehensive coverage of various cluster version states and UI elements.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Apr 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-81744, 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 (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

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

Details

In response to this:

Summary

Replaces the Cypress integration test for cluster update status with comprehensive React Testing Library unit tests. This provides faster, more maintainable tests with identical coverage.

Changes

  • Removed: packages/integration-tests/tests/cluster-settings/update-status.cy.ts
  • Added: public/components/cluster-settings/__tests__/cluster-status.spec.tsx

Benefits

  • 50-100x faster execution - Tests run in milliseconds instead of seconds
  • 🎯 Better isolation - Direct component testing with mock data, no network intercepts
  • Accessible queries - Uses RTL best practices (getByRole, getByText)
  • 🧹 Cleaner structure - Nested describe blocks for better organization

Test Coverage

All 9 status scenarios from the original Cypress test are covered:

  1. Invalid cluster version with cancel button
  2. Release not accepted with conditions link
  3. Updates available message
  4. Cluster updating with version
  5. Updating and failing simultaneously
  6. No channel configured
  7. Error retrieving updates
  8. Update failing
  9. Up to date message

Test Validation

  • ✅ All 9 tests pass (100% pass rate)
  • ✅ Zero act() warnings
  • ✅ Zero TypeScript/ESLint errors
  • ✅ No debugging code or unused imports
  • ✅ Follows OCP Console RTL best practices

Related

JIRA: https://redhat.atlassian.net/browse/OCPBUGS-81744

🤖 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 cajieh and sg00dwin April 6, 2026 17:09
@openshift-ci openshift-ci bot added component/core Related to console core functionality 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 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-81744, which is valid.

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

In response to this:

Summary

Replaces the Cypress integration test for cluster update status with comprehensive React Testing Library unit tests. This provides faster, more maintainable tests with identical coverage.

Changes

  • Removed: packages/integration-tests/tests/cluster-settings/update-status.cy.ts
  • Added: public/components/cluster-settings/__tests__/cluster-status.spec.tsx

Benefits

  • 50-100x faster execution - Tests run in milliseconds instead of seconds
  • 🎯 Better isolation - Direct component testing with mock data, no network intercepts
  • Accessible queries - Uses RTL best practices (getByRole, getByText)
  • 🧹 Cleaner structure - Nested describe blocks for better organization

Test Coverage

All 9 status scenarios from the original Cypress test are covered:

  1. Invalid cluster version with cancel button
  2. Release not accepted with conditions link
  3. Updates available message
  4. Cluster updating with version
  5. Updating and failing simultaneously
  6. No channel configured
  7. Error retrieving updates
  8. Update failing
  9. Up to date message

Test Validation

  • ✅ All 9 tests pass (100% pass rate)
  • ✅ Zero act() warnings
  • ✅ Zero TypeScript/ESLint errors
  • ✅ No debugging code or unused imports
  • ✅ Follows OCP Console RTL best practices

Related

JIRA: https://redhat.atlassian.net/browse/OCPBUGS-81744

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
  • Removed integration test for cluster settings update status functionality.
  • Added unit test suite for cluster status component with comprehensive coverage of various cluster version states and UI elements.

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

This pull request transitions test coverage for the UpdateStatus component from end-to-end integration testing to unit testing. The Cypress spec frontend/packages/integration-tests/tests/cluster-settings/update-status.cy.ts (which validated UI elements through mocked Kubernetes API responses) has been removed. In its place, a new Jest unit test suite frontend/public/components/cluster-settings/__tests__/cluster-status.spec.tsx was added, providing test coverage for the component's rendering across multiple ClusterVersion condition states including invalid versions, pending acceptance, available updates, in-progress updates, failures, retrieval errors, and up-to-date scenarios.

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

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

Copy link
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (1)
frontend/public/components/cluster-settings/__tests__/cluster-status.spec.tsx (1)

11-13: Add interaction tests for "View conditions" overlay triggers

The useOverlay mock is defined but never exercised—tests confirm the "View conditions" links exist (lines 89, 132, 151, 217) but don't click them or assert the overlay is launched. If overlay behavior should be validated, add interaction tests that exercise the link and verify useOverlay was called with the correct modal component. The suggested mock strengthening would then be meaningful.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/public/components/cluster-settings/__tests__/cluster-status.spec.tsx`
around lines 11 - 13, Add interaction tests that exercise the existing
useOverlay mock: import or access the mocked useOverlay from the test, simulate
user clicks on the "View conditions" links found in the component (the same
elements your current tests locate by text), and assert the mocked useOverlay
function was called and received the expected modal component/config (e.g., the
Conditions modal component) as an argument; also ensure to clear/reset the mock
between test cases. Use the existing useOverlay mock symbol and the "View
conditions" link text to locate the elements and verify the overlay invocation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@frontend/public/components/cluster-settings/__tests__/cluster-status.spec.tsx`:
- Around line 11-13: Add interaction tests that exercise the existing useOverlay
mock: import or access the mocked useOverlay from the test, simulate user clicks
on the "View conditions" links found in the component (the same elements your
current tests locate by text), and assert the mocked useOverlay function was
called and received the expected modal component/config (e.g., the Conditions
modal component) as an argument; also ensure to clear/reset the mock between
test cases. Use the existing useOverlay mock symbol and the "View conditions"
link text to locate the elements and verify the overlay invocation.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 5eb141fb-36b1-4b2d-be5b-6d13e19adc5f

📥 Commits

Reviewing files that changed from the base of the PR and between d0f1252 and 46e6e4c.

📒 Files selected for processing (2)
  • frontend/packages/integration-tests/tests/cluster-settings/update-status.cy.ts
  • frontend/public/components/cluster-settings/__tests__/cluster-status.spec.tsx
💤 Files with no reviewable changes (1)
  • frontend/packages/integration-tests/tests/cluster-settings/update-status.cy.ts
📜 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/public/components/cluster-settings/__tests__/cluster-status.spec.tsx
🔇 Additional comments (1)
frontend/public/components/cluster-settings/__tests__/cluster-status.spec.tsx (1)

54-243: Solid scenario coverage for status rendering

This suite covers the important UpdateStatus branches well, including the combined progressing+failing path and both retrieval-error variants.

… test

Replace Cypress integration test with comprehensive React Testing Library
unit tests for the UpdateStatus component. The unit tests cover all 9
status scenarios from the original integration test while providing:

- 50-100x faster execution (milliseconds vs seconds)
- Better test isolation with direct component testing
- Accessible queries following RTL best practices
- Improved maintainability with clear test structure

All test cases covered:
- Invalid cluster version
- Release not accepted
- Updates available
- Cluster updating
- Updating and failing simultaneously
- No channel configured
- Error retrieving updates
- Update failing
- Up to date

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 6, 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.

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

@logonoff
Copy link
Copy Markdown
Member

logonoff commented Apr 7, 2026

/verified by CI

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

openshift-ci bot commented Apr 7, 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

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

@logonoff: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

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

@rhamilto: Jira Issue Verification Checks: Jira Issue OCPBUGS-81744
✔️ 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-81744 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

Replaces the Cypress integration test for cluster update status with comprehensive React Testing Library unit tests. This provides faster, more maintainable tests with identical coverage.

Changes

  • Removed: packages/integration-tests/tests/cluster-settings/update-status.cy.ts
  • Added: public/components/cluster-settings/__tests__/cluster-status.spec.tsx

Benefits

  • 50-100x faster execution - Tests run in milliseconds instead of seconds
  • 🎯 Better isolation - Direct component testing with mock data, no network intercepts
  • Accessible queries - Uses RTL best practices (getByRole, getByText)
  • 🧹 Cleaner structure - Nested describe blocks for better organization

Test Coverage

All 9 status scenarios from the original Cypress test are covered:

  1. Invalid cluster version with cancel button
  2. Release not accepted with conditions link
  3. Updates available message
  4. Cluster updating with version
  5. Updating and failing simultaneously
  6. No channel configured
  7. Error retrieving updates
  8. Update failing
  9. Up to date message

Test Validation

  • ✅ All 9 tests pass (100% pass rate)
  • ✅ Zero act() warnings
  • ✅ Zero TypeScript/ESLint errors
  • ✅ No debugging code or unused imports
  • ✅ Follows OCP Console RTL best practices

Related

JIRA: https://redhat.atlassian.net/browse/OCPBUGS-81744

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
  • Removed integration test for cluster settings update status functionality.
  • Added unit test suite for cluster status component with comprehensive coverage of various cluster version states and UI elements.

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.

@logonoff logonoff deleted the OCPBUGS-81744 branch April 7, 2026 14:17
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. component/core Related to console core functionality 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.

3 participants