Skip to content

test: add unit tests for Certificate, CA, and ReportProcessor controllers#130

Merged
slauger merged 1 commit intomainfrom
feat/116-controller-unit-tests
Mar 16, 2026
Merged

test: add unit tests for Certificate, CA, and ReportProcessor controllers#130
slauger merged 1 commit intomainfrom
feat/116-controller-unit-tests

Conversation

@slauger
Copy link
Owner

@slauger slauger commented Mar 16, 2026

Summary

  • Add unit tests for CertificateReconciler, CertificateAuthorityReconciler, and ReportProcessorReconciler controllers, plus the csrPollBackoff pure function
  • Add reconciler constructors (newCertificateReconciler, newCertificateAuthorityReconciler, newReportProcessorReconciler) to testutil_test.go
  • 20 new tests across 4 files covering NotFound, phase transitions, PVC/RBAC/Job creation, resource defaults, and requeue behavior

Closes #116

Test plan

  • go test ./internal/controller/... -v -count=1 — all 74 tests pass
  • go vet ./... — clean

…tProcessor controllers (#116)

Add unit tests covering the reconcile loops of three previously untested
controllers plus the csrPollBackoff pure function. Tests use the existing
fake-client infrastructure from testutil_test.go.

New test files:
- certificateauthority_controller_test.go (12 tests)
- certificate_controller_test.go (5 tests)
- certificate_signing_test.go (1 table-driven test, 13 cases)
- reportprocessor_controller_test.go (2 tests)
@slauger slauger merged commit 1556094 into main Mar 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for Certificate and CertificateAuthority controllers

1 participant