Description
Two functions in pkg/util/work.go currently lack unit test coverage:
SetLabelsAndAnnotationsForWorkload
GetWorkSuspendDispatching
Why This Is Needed
SetLabelsAndAnnotationsForWorkload copies labels and annotations from a Work object to a workload unstructured object. It contains merging logic that should be verified.
GetWorkSuspendDispatching extracts suspend dispatching cluster names from a WorkSpec. It handles both nil and non-nil spec, plus the case where the suspend condition is absent.
Adding tests ensures correctness and prevents regressions.
Solution
Add unit tests following existing test patterns in work_test.go.
Description
Two functions in
pkg/util/work.gocurrently lack unit test coverage:SetLabelsAndAnnotationsForWorkloadGetWorkSuspendDispatchingWhy This Is Needed
SetLabelsAndAnnotationsForWorkloadcopies labels and annotations from a Work object to a workload unstructured object. It contains merging logic that should be verified.GetWorkSuspendDispatchingextracts suspend dispatching cluster names from a WorkSpec. It handles both nil and non-nil spec, plus the case where the suspend condition is absent.Adding tests ensures correctness and prevents regressions.
Solution
Add unit tests following existing test patterns in
work_test.go.