-
Notifications
You must be signed in to change notification settings - Fork 435
NO-JIRA: test(assets): add unit test for CAPI resources file paths #7601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NO-JIRA: test(assets): add unit test for CAPI resources file paths #7601
Conversation
Add TestCapiResources to verify all entries in the capiResources map point to existing embedded files that parse correctly. This catches mismatches between the map and actual CRD file paths at test time rather than causing runtime panics. The test includes: - Positive test iterating all capiResources paths - Negative test verifying non-existent paths correctly panic Follows project conventions with "When...it should..." naming format. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
WalkthroughAdds unit tests for the assets package in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes ✨ Finishing touches
Comment |
|
@cblecker: This pull request explicitly references no jira issue. 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. |
|
/verified by unit test |
|
@csrwng: This PR has been marked as verified by 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. |
|
/retest-required |
|
@cblecker: 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. |
apahim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: apahim, cblecker, csrwng 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 |
|
/area platform/gcp |
Summary
Add a unit test to verify all entries in the
capiResourcesmap point to existing embedded files that parse correctly. This catches mismatches between the map and actual CRD file paths at test time rather than causing runtime panics.Problem
PR #7305 introduced an edge case CI failure where CRD file paths were renamed but the
capiResourcesmap wasn't updated to match, causing runtime panics when trying to open non-existent embedded files.Solution
The test iterates through all entries in
capiResourcesand callsgetCustomResourceDefinition()for each path, verifying:Changes
TestCapiResourceswith:capiResourcespaths exist and parseTesting
go test -v ./cmd/install/assets/... -run TestCapiResourcesAll tests pass successfully. The test will catch any future mismatches between the
capiResourcesmap and embedded CRD file paths.