From b5f177efa0abc43ae12333d47f346bcfaef0b89e Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Sun, 14 Dec 2025 12:29:45 +0100 Subject: [PATCH] refactor(TestFindDuplicatePods): have a pod fully created through BuildTestPod without any edits --- .../plugins/removeduplicates/removeduplicates_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/framework/plugins/removeduplicates/removeduplicates_test.go b/pkg/framework/plugins/removeduplicates/removeduplicates_test.go index a3490624b..8e86c6303 100644 --- a/pkg/framework/plugins/removeduplicates/removeduplicates_test.go +++ b/pkg/framework/plugins/removeduplicates/removeduplicates_test.go @@ -110,8 +110,12 @@ func TestFindDuplicatePods(t *testing.T) { priority := utils.SystemCriticalPriority pod.Spec.Priority = &priority }) - p8 := test.BuildTestPod("p8", 100, 0, node1.Name, nil) - p8.Namespace = "test" + // Three Pods in the "test" Namespace, bound to same ReplicaSet. 2 should be evicted. + ownerRef2 := test.GetReplicaSetOwnerRefList() + p8 := test.BuildTestPod("p8", 100, 0, node1.Name, func(pod *v1.Pod) { + pod.Namespace = "test" + pod.ObjectMeta.OwnerReferences = ownerRef2 + }) p9 := test.BuildTestPod("p9", 100, 0, node1.Name, nil) p9.Namespace = "test" p10 := test.BuildTestPod("p10", 100, 0, node1.Name, nil) @@ -143,9 +147,6 @@ func TestFindDuplicatePods(t *testing.T) { // ### Evictable Pods ### - // Three Pods in the "test" Namespace, bound to same ReplicaSet. 2 should be evicted. - ownerRef2 := test.GetReplicaSetOwnerRefList() - p8.ObjectMeta.OwnerReferences = ownerRef2 p9.ObjectMeta.OwnerReferences = ownerRef2 p10.ObjectMeta.OwnerReferences = ownerRef2