[cert-manager-1.19] CM-902: Add table-driven unit tests and improve coverage#401
Conversation
- Add unit tests for modified functions to improve coverage - Align trustmanager utils tests with table-driven style - Add table-driven tests for refactor safety across controller packages - Update common and deployment test files; remove obsolete istiocsr test Made-with: Cursor
- Use a non-nil sentinel client.Client in client tests so happy path asserts manager client is wired by pointer identity, not nil==nil. - Add a valid TrustManagerConfig case to TestValidateTrustManagerConfig to exercise validateTrustManagerConfig success path. Made-with: Cursor
…lder - Use ObjectMetadataModified in common utils tests (HasObjectChanged does not exist). - Fix ValidateTrustManagerConfig case to use trustManagerBuilder and drop invalid wantErr. Made-with: Cursor
Return (nil, error) from NewClient when manager is nil instead of panicking. Tighten withCloudCredentials tests: decoy-secret flag, NotFound only when expected, required VolumeMounts when wantMountPath is set. Remove duplicate bindata Asset case; format MustAsset panic recovery safely. Made-with: Cursor
When wantNotFoundOK is set, pass only if apierrors.IsNotFound(err) and the error message contains wantErr, avoiding unrelated NotFound matches. Made-with: Cursor
Drop tests that only exercised go-bindata and applyconfiguration-gen output. Coverage should focus on hand-written operator logic; generated packages are not maintained as test targets. Made-with: Cursor
The manager is always non-nil when controllers construct the client; removing the guard simplifies the code path for test coverage. Made-with: Cursor
- credentials_request_test: expect full hook error strings; drop wantNotFoundOK - utils_test: consolidate ObjectMetadataModified cases; table-driven annotation tests - errors_test: keep nil-input cases; remove generated fake client tests Made-with: Cursor
|
@openshift-cherrypick-robot: Ignoring requests to cherry-pick non-bug issues: CM-902 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. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This is an automated cherrypick PR, hence adding all required labels |
|
@openshift-cherrypick-robot: This pull request references CM-902 which is a valid 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bharath-b-rh, openshift-cherrypick-robot 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 |
f0996cf
into
openshift:cert-manager-1.19
This is an automated cherry-pick of #385
/assign bharath-b-rh