-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
What type of issue is this?
/kind feature
Issue Description
The pkg/util/hash package currently has 0% test coverage. This package contains the DeepHashObject function which is used by pkg/util/names for
generating deterministic hash-based names for resources like PolicyNames.
Why is this important?
- Correctness Risk: If this function produces inconsistent hashes across Go versions or dependency updates, it could cause
ResourceBinding/PropagationPolicy name collisions or lookup failures. - Regression Detection: Without tests, refactoring or dependency updates could silently break hash consistency.
- Test Coverage Gap: The
pkg/util/directory has good test coverage generally, but this package is a blind spot.
Proposed Solution
Add comprehensive unit tests covering:
- Basic types (strings, integers, booleans, floats)
- Complex types (structs, maps, slices)
- Nested structures
- Nil values and edge cases
- Hasher reset behavior
- Determinism verification
Additional context
This is a good first issue as it:
- Is completely isolated (single utility function)
- Has clear success criteria (tests pass, 100% coverage)
- Introduces contributors to Karmada's testing patterns
- Is low-risk (adding tests cannot break existing functionality)
Metadata
Metadata
Assignees
Labels
No labels