From ca0f7535fb39326c76c5c655fedcfa302669e44b Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Mon, 15 Dec 2025 17:41:25 +0100 Subject: [PATCH] refactor: add SetMirrorPodAnnotation helper function --- .../plugins/removepodsviolatingnodetaints/node_taint_test.go | 4 +--- test/test_utils.go | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/framework/plugins/removepodsviolatingnodetaints/node_taint_test.go b/pkg/framework/plugins/removepodsviolatingnodetaints/node_taint_test.go index 15af32547..6bcc5239e 100644 --- a/pkg/framework/plugins/removepodsviolatingnodetaints/node_taint_test.go +++ b/pkg/framework/plugins/removepodsviolatingnodetaints/node_taint_test.go @@ -156,9 +156,7 @@ func TestDeletePodsViolatingNodeTaints(t *testing.T) { }, } }) - p10 := buildTestPodWithNormalOwnerRef("p10", nodeName2, func(pod *v1.Pod) { - pod.Annotations = test.GetMirrorPodAnnotation() - }) + p10 := buildTestPodWithNormalOwnerRef("p10", nodeName2, test.SetMirrorPodAnnotation) p11 := buildTestPodWithNormalOwnerRef("p11", nodeName2, nil) p12 := buildTestPodWithNormalOwnerRef("p11", nodeName2, func(pod *v1.Pod) { pod.Spec.NodeSelector = map[string]string{ diff --git a/test/test_utils.go b/test/test_utils.go index 186af2721..7c67dd247 100644 --- a/test/test_utils.go +++ b/test/test_utils.go @@ -252,6 +252,11 @@ func SetNormalOwnerRef(pod *v1.Pod) { pod.ObjectMeta.OwnerReferences = GetNormalPodOwnerRefList() } +// SetMirrorPodAnnotation sets the given pod's annotations to mirror pod annotations +func SetMirrorPodAnnotation(pod *v1.Pod) { + pod.Annotations = GetMirrorPodAnnotation() +} + // SetPodPriority sets the given pod's priority func SetPodPriority(pod *v1.Pod, priority int32) { pod.Spec.Priority = &priority