Skip to content

[cert-manager-1.19] CM-902: Add table-driven unit tests and improve coverage#401

Merged
openshift-merge-bot[bot] merged 8 commits intoopenshift:cert-manager-1.19from
openshift-cherrypick-robot:cherry-pick-385-to-cert-manager-1.19
Apr 9, 2026
Merged

[cert-manager-1.19] CM-902: Add table-driven unit tests and improve coverage#401
openshift-merge-bot[bot] merged 8 commits intoopenshift:cert-manager-1.19from
openshift-cherrypick-robot:cherry-pick-385-to-cert-manager-1.19

Conversation

@openshift-cherrypick-robot
Copy link
Copy Markdown

This is an automated cherry-pick of #385

/assign bharath-b-rh

Anand Kumar added 8 commits April 9, 2026 10:00
- 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-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 9, 2026

@openshift-cherrypick-robot: Ignoring requests to cherry-pick non-bug issues: CM-902

Details

In response to this:

This is an automated cherry-pick of #385

/assign bharath-b-rh

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

coderabbitai Bot commented Apr 9, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fa762e1d-4d23-49a1-86b0-990379ec6a09

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

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

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

@openshift-ci openshift-ci Bot requested review from TrilokGeer and mytreya-rh April 9, 2026 10:01
@bharath-b-rh
Copy link
Copy Markdown
Contributor

This is an automated cherrypick PR, hence adding all required labels
/lgtm
/approve
/label docs-approved
/label px-approved
/label qe-approved

@openshift-ci openshift-ci Bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR labels Apr 9, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 9, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 9, 2026

@openshift-cherrypick-robot: This pull request references CM-902 which is a valid jira issue.

Details

In response to this:

This is an automated cherry-pick of #385

/assign bharath-b-rh

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 added the lgtm Indicates that a PR is ready to be merged. label Apr 9, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 9, 2026

[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

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 openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit f0996cf into openshift:cert-manager-1.19 Apr 9, 2026
9 of 10 checks passed
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. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants