OCPBUGS-59569: Disable create button until CRD is available#16633
OCPBUGS-59569: Disable create button until CRD is available#16633rhamilto wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Walkthrough
ChangesModel availability and refresh trigger
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (14 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/assign @TheRealJon |
|
/jira refresh |
|
@rhamilto: This pull request references Jira Issue OCPBUGS-59569, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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: This pull request references Jira Issue OCPBUGS-59569, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhamilto The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/packages/operator-lifecycle-manager/src/components/__tests__/operator-install-page.spec.tsx (1)
37-41: ⚡ Quick winAdd
afterEach(() => jest.restoreAllMocks())for test isolation consistency.The suite clears call history but does not restore mocks after each test.
As per coding guidelines, “Clean up mocks in unit tests by calling
jest.restoreAllMocks()inafterEach()blocks.”Suggested update
describe('CreateInitializationResourceButton', () => { beforeEach(() => { jest.clearAllMocks(); mockModel = undefined; mockInFlight = false; }); + + afterEach(() => { + jest.restoreAllMocks(); + });🤖 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 `@frontend/packages/operator-lifecycle-manager/src/components/__tests__/operator-install-page.spec.tsx` around lines 37 - 41, Add an afterEach hook in the operator-install-page.spec.tsx test file to properly restore all mocks after each test completes, ensuring consistent test isolation. Place the afterEach hook immediately after the existing beforeEach hook and call jest.restoreAllMocks() within it to fully clean up mock state between tests.Source: Coding guidelines
🤖 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
`@frontend/packages/operator-lifecycle-manager/src/components/__tests__/operator-install-page.spec.tsx`:
- Around line 50-53: The test for "dispatches getResources when the model is
missing" in the CreateInitializationResourceButton component only asserts that
mockDispatch was called once, but does not verify that it was called with the
specific getResources action. Add an additional expectation to assert that
mockDispatch was invoked with the getResources action as its argument, so the
test validates the actual contract described by its name rather than just any
dispatch call.
---
Nitpick comments:
In
`@frontend/packages/operator-lifecycle-manager/src/components/__tests__/operator-install-page.spec.tsx`:
- Around line 37-41: Add an afterEach hook in the operator-install-page.spec.tsx
test file to properly restore all mocks after each test completes, ensuring
consistent test isolation. Place the afterEach hook immediately after the
existing beforeEach hook and call jest.restoreAllMocks() within it to fully
clean up mock state between tests.
🪄 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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: eae86129-87a6-4d4d-a53d-5191bf94de9d
📒 Files selected for processing (2)
frontend/packages/operator-lifecycle-manager/src/components/__tests__/operator-install-page.spec.tsxfrontend/packages/operator-lifecycle-manager/src/components/operator-install-page.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/packages/operator-lifecycle-manager/src/components/operator-install-page.tsx
|
/retest |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@rhamilto: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Analysis / Root cause:
After an operator installs, the install success page immediately shows a "Create " button linked to the initialization resource. However, the CRD may not yet be registered on the cluster (API discovery polls every 60 seconds), so clicking the button leads to a 404 error.
Solution description:
The
CreateInitializationResourceButtoncomponent now usesuseK8sModelto check whether the CRD model has been discovered. The button is disabled until the model is available. Additionally, auseEffecttriggers an immediate API discovery refresh (getResources()) when the model is missing, so the user doesn't have to wait for the next 60-second poll cycle. This follows the existing pattern used inProvidedAPIsPage.Screenshots / screen recording:
Test setup:
Install an operator that declares an initialization resource (e.g. Network Observability with FlowCollector).
Test cases:
Unit tests:
Added
operator-install-page.spec.tsxcovering:getResourceswhen the CRD model is missingdisabledprop is trueBrowser conformance:
Additional info:
https://redhat.atlassian.net/browse/OCPBUGS-59569
Reviewers and assignees:
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests