-
Sub-task
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
None
-
None
-
False
-
-
False
-
None
-
None
-
None
-
None
-
None
Implement comprehensive unit tests for PKI API types, validation logic, and helper functions.
Test Coverage Requirements
Target: >80% code coverage for all PKI-related code
Test Categories
Type Validation Tests:
- Valid configurations accepted
- Invalid configurations rejected with clear errors
- Enum validation (algorithms, key sizes, curves)
- Required field validation
- Default value behavior
Configuration Hierarchy Tests:
- Specific overrides take precedence over category config
- Category config overrides default config
- Default config used when no overrides present
- Nil/empty value handling
Edge Cases:
- Empty PKI resource
- Missing optional fields
- Conflicting configurations
- Invalid certificate name references
Test File Location
openshift/api/config/v1alpha1/types_pki_test.go
Test Utilities
- Table-driven tests for validation scenarios
- Helper functions for creating test PKI objects
- Assertion helpers for common validations
Acceptance Criteria
- Unit tests achieve >80% coverage of PKI code
- All validation rules have corresponding tests
- Tests pass in CI (make test in openshift/api)
- No flaky or race-prone tests
- Test names clearly describe what is being tested
- Failure messages are actionable
- duplicates
-
CNTRLPLANE-1749 duplicate: Unit tests for PKI API types
-
- Closed
-