-
Notifications
You must be signed in to change notification settings - Fork 143
CNTRLPLANE-2272:Refactor tests-ext initialization to improve error handling #457
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
base: main
Are you sure you want to change the base?
CNTRLPLANE-2272:Refactor tests-ext initialization to improve error handling #457
Conversation
This change improves error handling in the cluster-config-operator-tests-ext command by following Go best practices: - Modified newOperatorTestCommand() to return (*cobra.Command, error) - Modified prepareOperatorTestsRegistry() to return (*oteextension.Registry, error) - Added proper error wrapping with context - Simplified main() function and removed unused context parameter This aligns with the pattern established in oauth-apiserver PR openshift#162 and makes the code more testable and maintainable.
WalkthroughThis PR refactors error handling in the operator test command initialization. Two function signatures were updated to return errors: Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (4)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wangke19 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@wangke19: This pull request references CNTRLPLANE-2272 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.22.0" version, but no target version was set. 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. |
|
@wangke19: This pull request references CNTRLPLANE-2272 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.22.0" version, but no target version was set. 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. |
|
@wangke19: The following test failed, say
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. |
Summary
This PR refactors the
cluster-config-operator-tests-extinitialization code to improve error handling and follow Go best practices. The changes align with the pattern established in oauth-apiserver PR #162.Changes
newOperatorTestCommand()to return(*cobra.Command, error)instead of*cobra.CommandprepareOperatorTestsRegistry()to return(*oteextension.Registry, error)instead of*oteextension.Registryfmt.Errorf("failed to prepare test registry: %w", err)main()function and removed unusedcontext.Contextparameter"context"import with"fmt"for error formattingBenefits
klog.Fatal()directlyTesting
make build./cluster-config-operator-tests-ext --help