Skip to content

CNF-26153: Add unit tests across codebase to close coverage gaps - #461

Open
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
sebrandon1:unit-test-coverage-gaps
Open

CNF-26153: Add unit tests across codebase to close coverage gaps#461
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
sebrandon1:unit-test-coverage-gaps

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

Jira: CNF-26153

Full-codebase unit test audit identified 42 coverage gaps across 12 packages. This PR addresses the high and medium priority gaps, adding 3,337 lines of new test code across 18 files (11 new, 7 modified) without touching any production code.

New test coverage by package

Package New Tests What is Covered
pkg/controller/certmanager ~50 Network policy validation, default CertManager controller, log level hook, deployment helper overrides (args/env/labels), unsupported overrides invalid JSON, related images for all operands
pkg/controller/common ~50 Client methods (Exists/Get/Create/Update/UpdateWithRetry/Patch/StatusUpdate), HandleReconcileResult (3 branches), 6 validation functions, utility functions
pkg/controller/trustmanager ~30 managedAnnotationsModified, addFinalizer/removeFinalizer error branches, updateStatus retry logic, containerPortsMatch, readinessProbeModified, webhook rules and AdmissionReviewVersions drift
pkg/controller/istiocsr ~17 Network policy CRUD (6 scenarios), validateIstioCSRConfig (5 branches), updateCondition (4 branches)
pkg/features ~6 IsIstioCSRFeatureGateEnabled, SetupWithFlagValue invalid flag
pkg/operator/operatorclient ~13 GetOperatorState, EnsureFinalizer, RemoveFinalizer, ApplyOperatorStatus, GetUnsupportedConfigOverrides
pkg/operator ~8 buildCacheObjectList, addControllerCacheConfig, findExistingCacheEntry

Bug found

pkg/controller/istiocsr/utils.go:484 -- updateCondition aggregates {err, errUpdate} instead of {prependErr, errUpdate}, losing the original reconcile error when both the reconcile and the status update fail. The http01proxy version of the same function correctly uses prependErr. A test documents this bug.

Test plan

  • All 638 tests pass across affected packages
  • make lint passes (no new lint issues in test files)
  • No production code modified

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@sebrandon1: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

Full-codebase unit test audit identified 42 coverage gaps across 12 packages. This PR addresses the high and medium priority gaps, adding 3,337 lines of new test code across 18 files (11 new, 7 modified) without touching any production code.

New test coverage by package

Package New Tests What is Covered
pkg/controller/certmanager ~50 Network policy validation, default CertManager controller, log level hook, deployment helper overrides (args/env/labels), unsupported overrides invalid JSON, related images for all operands
pkg/controller/common ~50 Client methods (Exists/Get/Create/Update/UpdateWithRetry/Patch/StatusUpdate), HandleReconcileResult (3 branches), 6 validation functions, utility functions
pkg/controller/trustmanager ~30 managedAnnotationsModified, addFinalizer/removeFinalizer error branches, updateStatus retry logic, containerPortsMatch, readinessProbeModified, webhook rules and AdmissionReviewVersions drift
pkg/controller/istiocsr ~17 Network policy CRUD (6 scenarios), validateIstioCSRConfig (5 branches), updateCondition (4 branches)
pkg/features ~6 IsIstioCSRFeatureGateEnabled, SetupWithFlagValue invalid flag
pkg/operator/operatorclient ~13 GetOperatorState, EnsureFinalizer, RemoveFinalizer, ApplyOperatorStatus, GetUnsupportedConfigOverrides
pkg/operator ~8 buildCacheObjectList, addControllerCacheConfig, findExistingCacheEntry

Bug found

pkg/controller/istiocsr/utils.go:484 - updateCondition aggregates {err, errUpdate} instead of {prependErr, errUpdate}, losing the original reconcile error when both the reconcile and the status update fail. The http01proxy version of the same function correctly uses prependErr. A test documents this bug.

Test plan

  • All 638 tests pass across affected packages
  • make lint passes (no new lint issues in test files)
  • No production code modified

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

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Walkthrough

Adds broad unit-test coverage for cert-manager, common controller utilities, IstioCSR, trust-manager, feature gates, operator client behavior, finalizers, status handling, and cache selector configuration.

Changes

Cert-manager controller coverage

Layer / File(s) Summary
Network policy and default resource validation
pkg/controller/certmanager/cert_manager_networkpolicy_test.go, pkg/controller/certmanager/default_cert_manager_controller_test.go
Tests component validation, pod selectors, network policy generation, default CertManager creation, and duplicate creation errors.
Deployment configuration and image handling
pkg/controller/certmanager/deployment_helper_test.go, pkg/controller/certmanager/deployment_log_level_test.go, pkg/controller/certmanager/deployment_overrides_test.go, pkg/controller/certmanager/related_images_test.go
Tests deployment arguments, environment variables, pod labels, log levels, unsupported overrides, and related-image selection.

Common controller coverage

Layer / File(s) Summary
Client and reconcile result behavior
pkg/controller/common/client_test.go, pkg/controller/common/reconcile_result_test.go
Tests client operations, retries, patches, status updates, reconcile results, condition transitions, and unchanged-condition handling.
Metadata, decoding, and validation helpers
pkg/controller/common/utils_test.go, pkg/controller/common/validation_test.go
Tests name mutation, object decoding, and validation of labels, annotations, selectors, tolerations, resources, and affinity.

IstioCSR coverage

Layer / File(s) Summary
Network policy and status handling
pkg/controller/istiocsr/networkpolicies_test.go, pkg/controller/istiocsr/utils_test.go
Tests configuration validation, network policy create/update decisions, and status-update error propagation.

Trust-manager coverage

Layer / File(s) Summary
Deployment and reconciliation comparisons
pkg/controller/trustmanager/deployments_test.go, pkg/controller/trustmanager/utils_test.go, pkg/controller/trustmanager/webhooks_test.go
Tests container and probe comparisons, managed annotation changes, finalizer and status failures, and webhook drift patching.

Feature and operator coverage

Layer / File(s) Summary
Feature gates and operator client
pkg/features/features_test.go, pkg/operator/operatorclient/operatorclient_test.go
Tests IstioCSR feature toggling, invalid flags, unsupported configuration parsing, operator state retrieval, finalizers, and status application.
Controller cache configuration
pkg/operator/setup_manager_test.go
Tests cache object construction, selector merging, resource lookup, and label-set matching.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: swghosh, bharath-b-rh

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.30% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All 18 changed test files use Go testing, with no Ginkgo declarations or imports; t.Run names are literals or static table keys.
Test Structure And Quality ✅ Passed PASS: All 18 changed files use testing.T/testify, not Ginkgo/Gomega; no It, Eventually, BeforeEach, or AfterEach blocks or cluster-backed tests were added.
Microshift Test Compatibility ✅ Passed The PR adds Go unit tests using testing.T, not Ginkgo e2e tests; no Describe/Context/It constructs or MicroShift compatibility review is required.
Single Node Openshift (Sno) Test Compatibility ✅ Passed All 18 changed files are Go unit-test files using standard testing.T; no new Ginkgo e2e tests or multi-node/SNO assumptions were found.
Topology-Aware Scheduling Compatibility ✅ Passed All 18 changed paths are Go test files; no manifests or production operator/controller code changed, and scheduling references are test fixtures only.
Ote Binary Stdout Contract ✅ Passed All 18 changed files are tests; searches found no stdout/logging calls or process-level hooks, and no production files changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The commit changes only 18 Go test files; searches found no Ginkgo DSL, IPv4 literals/parsing, IP-family assumptions, network/DNS calls, or external URL access.
No-Weak-Crypto ✅ Passed The PR changes only Go test files; searches found no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparison usage.
Container-Privileges ✅ Passed The PR changes only 18 Go test files. Added code contains no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings and adds no manifests.
No-Sensitive-Data-In-Logs ✅ Passed The diff adds no application logging or sensitive literals; its only explicit t.Log calls contain static bug notes, and all changed files are tests.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the pull request's main change: adding unit tests across the codebase to address coverage gaps.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2026
@openshift-ci
openshift-ci Bot requested review from bharath-b-rh and swghosh July 23, 2026 21:18
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign swghosh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
pkg/controller/certmanager/deployment_helper_test.go (1)

946-1377: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Triplicated informer/watch-reactor setup across three tests.

TestGetOverrideArgsFor, TestGetOverrideEnvFor, and TestGetOverridePodLabelsFor each re-implement the same ~90-line fake-clientset/watch-reactor/informer/channel setup and create-wait-assert-delete-wait loop. Extracting a shared helper would remove significant duplication and make future additions (e.g., a 4th override type) cheaper.

🤖 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 `@pkg/controller/certmanager/deployment_helper_test.go` around lines 946 -
1377, The three override tests duplicate identical informer setup and
create/delete event synchronization. Extract the shared fake client, watch
reactor, informer, event channel, and test-case execution loop into a reusable
helper, then have TestGetOverrideArgsFor, TestGetOverrideEnvFor, and
TestGetOverridePodLabelsFor provide only their test data and override assertion
logic while preserving existing error and cleanup behavior.
pkg/controller/certmanager/related_images_test.go (1)

68-69: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer t.Setenv over os.Setenv/defer os.Unsetenv.

t.Setenv auto-restores the env var even on failure and is the idiomatic Go testing pattern for this.

♻️ Example for one case
-			os.Setenv("RELATED_IMAGE_CERT_MANAGER_WEBHOOK", tt.envVarValue)
-			defer os.Unsetenv("RELATED_IMAGE_CERT_MANAGER_WEBHOOK")
+			t.Setenv("RELATED_IMAGE_CERT_MANAGER_WEBHOOK", tt.envVarValue)

Also applies to: 99-100, 130-131, 141-142

🤖 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 `@pkg/controller/certmanager/related_images_test.go` around lines 68 - 69,
Replace the os.Setenv/defer os.Unsetenv calls in the related image test cases
with t.Setenv, including the cases around the existing environment-variable
setup blocks, so each test automatically restores
RELATED_IMAGE_CERT_MANAGER_WEBHOOK.
🤖 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 `@pkg/controller/istiocsr/utils_test.go`:
- Around line 199-211: Remove the non-asserting checkBuggyAggregate logging
block, or replace it with a real assertion that verifies the aggregate includes
“original reconcile error” when prependErr is set and the status update fails.
Keep the existing wantErrMsg validation as the primary regression check and
eliminate misleading t.Log-only behavior.

---

Nitpick comments:
In `@pkg/controller/certmanager/deployment_helper_test.go`:
- Around line 946-1377: The three override tests duplicate identical informer
setup and create/delete event synchronization. Extract the shared fake client,
watch reactor, informer, event channel, and test-case execution loop into a
reusable helper, then have TestGetOverrideArgsFor, TestGetOverrideEnvFor, and
TestGetOverridePodLabelsFor provide only their test data and override assertion
logic while preserving existing error and cleanup behavior.

In `@pkg/controller/certmanager/related_images_test.go`:
- Around line 68-69: Replace the os.Setenv/defer os.Unsetenv calls in the
related image test cases with t.Setenv, including the cases around the existing
environment-variable setup blocks, so each test automatically restores
RELATED_IMAGE_CERT_MANAGER_WEBHOOK.
🪄 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: 695c0df9-44c0-4988-8185-da9798463447

📥 Commits

Reviewing files that changed from the base of the PR and between 849995e and 9beb5eb.

📒 Files selected for processing (18)
  • pkg/controller/certmanager/cert_manager_networkpolicy_test.go
  • pkg/controller/certmanager/default_cert_manager_controller_test.go
  • pkg/controller/certmanager/deployment_helper_test.go
  • pkg/controller/certmanager/deployment_log_level_test.go
  • pkg/controller/certmanager/deployment_overrides_test.go
  • pkg/controller/certmanager/related_images_test.go
  • pkg/controller/common/client_test.go
  • pkg/controller/common/reconcile_result_test.go
  • pkg/controller/common/utils_test.go
  • pkg/controller/common/validation_test.go
  • pkg/controller/istiocsr/networkpolicies_test.go
  • pkg/controller/istiocsr/utils_test.go
  • pkg/controller/trustmanager/deployments_test.go
  • pkg/controller/trustmanager/utils_test.go
  • pkg/controller/trustmanager/webhooks_test.go
  • pkg/features/features_test.go
  • pkg/operator/operatorclient/operatorclient_test.go
  • pkg/operator/setup_manager_test.go

Comment thread pkg/controller/istiocsr/utils_test.go
@sebrandon1
sebrandon1 force-pushed the unit-test-coverage-gaps branch from 9beb5eb to f945972 Compare July 24, 2026 02:31
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2026
@sebrandon1 sebrandon1 changed the title NO-JIRA: Add unit tests across codebase to close coverage gaps CNF-26153: Add unit tests across codebase to close coverage gaps Jul 27, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 27, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-26153 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 story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Full-codebase unit test audit identified 42 coverage gaps across 12 packages. This PR addresses the high and medium priority gaps, adding 3,337 lines of new test code across 18 files (11 new, 7 modified) without touching any production code.

New test coverage by package

Package New Tests What is Covered
pkg/controller/certmanager ~50 Network policy validation, default CertManager controller, log level hook, deployment helper overrides (args/env/labels), unsupported overrides invalid JSON, related images for all operands
pkg/controller/common ~50 Client methods (Exists/Get/Create/Update/UpdateWithRetry/Patch/StatusUpdate), HandleReconcileResult (3 branches), 6 validation functions, utility functions
pkg/controller/trustmanager ~30 managedAnnotationsModified, addFinalizer/removeFinalizer error branches, updateStatus retry logic, containerPortsMatch, readinessProbeModified, webhook rules and AdmissionReviewVersions drift
pkg/controller/istiocsr ~17 Network policy CRUD (6 scenarios), validateIstioCSRConfig (5 branches), updateCondition (4 branches)
pkg/features ~6 IsIstioCSRFeatureGateEnabled, SetupWithFlagValue invalid flag
pkg/operator/operatorclient ~13 GetOperatorState, EnsureFinalizer, RemoveFinalizer, ApplyOperatorStatus, GetUnsupportedConfigOverrides
pkg/operator ~8 buildCacheObjectList, addControllerCacheConfig, findExistingCacheEntry

Bug found

pkg/controller/istiocsr/utils.go:484 - updateCondition aggregates {err, errUpdate} instead of {prependErr, errUpdate}, losing the original reconcile error when both the reconcile and the status update fail. The http01proxy version of the same function correctly uses prependErr. A test documents this bug.

Test plan

  • All 638 tests pass across affected packages
  • make lint passes (no new lint issues in test files)
  • No production code modified

Summary by CodeRabbit

  • Tests
  • Expanded automated coverage for CertManager network policy generation/validation, default CertManager creation, deployment overrides/log level handling, and related image overrides.
  • Expanded reconciliation tests for IstioCSR and TrustManager, including network policy create/update flows, readiness/probe logic, webhook drift patching, and finalizer/status handling.
  • Added shared controller test coverage for client wrappers, reconcile result/condition behavior, and common validation/encoding utilities.
  • Added feature gate and cache configuration tests, plus improved Operator client tests for overrides, finalizers, and status application.

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.

@sebrandon1
sebrandon1 force-pushed the unit-test-coverage-gaps branch from f945972 to 25a087d Compare August 3, 2026 15:23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
pkg/controller/istiocsr/networkpolicies_test.go (1)

75-208: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test case for istioCSRCreateRecon: true.

Every case in TestCreateOrUpdateNetworkPolicy leaves istioCSRCreateRecon at its zero value (false). Add a case with istioCSRCreateRecon: true to cover the reconciliation-creation code path of createOrUpdateNetworkPolicy, if that flag affects behavior.

🤖 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 `@pkg/controller/istiocsr/networkpolicies_test.go` around lines 75 - 208, Add a
table entry in TestCreateOrUpdateNetworkPolicy with istioCSRCreateRecon set to
true, configuring the fake client and assertions to exercise the
reconciliation-creation path of createOrUpdateNetworkPolicy. Verify the expected
create/update behavior for this flag while preserving the existing cases.
pkg/controller/common/client_test.go (1)

143-231: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the shared mockClient/mockStatusClient test doubles.

The graph context shows an essentially identical mockClient/mockStatusClient pair (same Get, Create, Update, Delete, List, Patch, Status structure) already exists in pkg/controller/certmanager/deployment_helper_test.go. Duplicating this scaffolding across packages increases the maintenance burden: any change to the client.Client interface signature requires updating every copy.

Move mockClient and mockStatusClient into a shared internal test helper package (for example pkg/controller/common/testutil or a small fakes package) that both pkg/controller/certmanager and pkg/controller/common tests import.

🤖 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 `@pkg/controller/common/client_test.go` around lines 143 - 231, Extract the
duplicated mockClient and mockStatusClient implementations from
pkg/controller/common and certmanager tests into a shared internal test helper
or fakes package. Export the helper types and preserve their configurable
callbacks and Client/Status method behavior, then update newCtrlClient and both
test suites to use the shared definitions and remove the local copies.
🤖 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 `@pkg/controller/certmanager/deployment_helper_test.go`:
- Around line 950-1015: Refactor TestGetOverrideArgsFor, TestGetOverrideEnvFor,
and TestGetOverridePodLabelsFor to reuse setupSyncedFakeCertManagerInformer and
withFakeCertManagerForTest instead of creating watchers, event handlers, and
create/delete flows inline. Remove the duplicated informer setup and channel
handling, preserving each test’s existing assertions and test data while relying
on the helpers’ checked AddEventHandler registration and tombstone-safe
DeleteFunc.

In `@pkg/operator/operatorclient/operatorclient_test.go`:
- Around line 124-126: Update the test comparison around json.Marshal to check
both error returns immediately, failing the test with the relevant error before
comparing got and want. Do not discard marshal errors, while preserving the
existing JSON string comparison in operatorclient tests.

---

Nitpick comments:
In `@pkg/controller/common/client_test.go`:
- Around line 143-231: Extract the duplicated mockClient and mockStatusClient
implementations from pkg/controller/common and certmanager tests into a shared
internal test helper or fakes package. Export the helper types and preserve
their configurable callbacks and Client/Status method behavior, then update
newCtrlClient and both test suites to use the shared definitions and remove the
local copies.

In `@pkg/controller/istiocsr/networkpolicies_test.go`:
- Around line 75-208: Add a table entry in TestCreateOrUpdateNetworkPolicy with
istioCSRCreateRecon set to true, configuring the fake client and assertions to
exercise the reconciliation-creation path of createOrUpdateNetworkPolicy. Verify
the expected create/update behavior for this flag while preserving the existing
cases.
🪄 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: 1bdc7251-3f53-4af1-bbe9-62ef5e2e8fa0

📥 Commits

Reviewing files that changed from the base of the PR and between f945972 and 25a087d.

📒 Files selected for processing (18)
  • pkg/controller/certmanager/cert_manager_networkpolicy_test.go
  • pkg/controller/certmanager/default_cert_manager_controller_test.go
  • pkg/controller/certmanager/deployment_helper_test.go
  • pkg/controller/certmanager/deployment_log_level_test.go
  • pkg/controller/certmanager/deployment_overrides_test.go
  • pkg/controller/certmanager/related_images_test.go
  • pkg/controller/common/client_test.go
  • pkg/controller/common/reconcile_result_test.go
  • pkg/controller/common/utils_test.go
  • pkg/controller/common/validation_test.go
  • pkg/controller/istiocsr/networkpolicies_test.go
  • pkg/controller/istiocsr/utils_test.go
  • pkg/controller/trustmanager/deployments_test.go
  • pkg/controller/trustmanager/utils_test.go
  • pkg/controller/trustmanager/webhooks_test.go
  • pkg/features/features_test.go
  • pkg/operator/operatorclient/operatorclient_test.go
  • pkg/operator/setup_manager_test.go
🚧 Files skipped from review as they are similar to previous changes (12)
  • pkg/controller/certmanager/deployment_overrides_test.go
  • pkg/features/features_test.go
  • pkg/controller/certmanager/default_cert_manager_controller_test.go
  • pkg/controller/trustmanager/webhooks_test.go
  • pkg/controller/trustmanager/deployments_test.go
  • pkg/operator/setup_manager_test.go
  • pkg/controller/common/reconcile_result_test.go
  • pkg/controller/trustmanager/utils_test.go
  • pkg/controller/certmanager/related_images_test.go
  • pkg/controller/common/utils_test.go
  • pkg/controller/certmanager/deployment_log_level_test.go
  • pkg/controller/istiocsr/utils_test.go

Comment thread pkg/controller/certmanager/deployment_helper_test.go
Comment thread pkg/operator/operatorclient/operatorclient_test.go
Full-codebase unit test audit identified 42 coverage gaps across 12
packages. This commit addresses the high and medium priority gaps
that can be covered without modifying production code.

New test files (11):
- pkg/controller/certmanager: network policy validation, default
  CertManager controller, deployment log level hook
- pkg/controller/common: client methods (Exists, Get, Create, Update,
  UpdateWithRetry, Patch, StatusUpdate), HandleReconcileResult,
  validation functions, utility functions
- pkg/controller/istiocsr: network policy CRUD, validateIstioCSRConfig,
  updateCondition
- pkg/operator/operatorclient: GetOperatorState, EnsureFinalizer,
  RemoveFinalizer, ApplyOperatorStatus, GetUnsupportedConfigOverrides
- pkg/operator: buildCacheObjectList, addControllerCacheConfig,
  findExistingCacheEntry

Modified test files (7):
- pkg/controller/certmanager: deployment helper override functions
  (args, env, labels), unsupported overrides invalid JSON, related
  images for webhook/cainjector/acmesolver
- pkg/controller/trustmanager: managedAnnotationsModified,
  addFinalizer/removeFinalizer edge cases, updateStatus retry,
  containerPortsMatch, readinessProbeModified, webhook rules and
  AdmissionReviewVersions drift
- pkg/features: IsIstioCSRFeatureGateEnabled, SetupWithFlagValue
  invalid flag

Notable finding: istiocsr utils.go:484 updateCondition aggregates
{err, errUpdate} instead of {prependErr, errUpdate}, losing the
original reconcile error when both fail. The http01proxy version
correctly uses prependErr. Test documents this bug.
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-operator-tech-preview 8cedfe4 link false /test e2e-operator-tech-preview

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants