From 56f49bc78f463a24c176a9466c3926ceac7b3d6e Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Sun, 14 Dec 2025 12:34:40 +0100 Subject: [PATCH] refactor(TestFindDuplicatePods): have a pod fully created through BuildTestPod without any edits --- .../removeduplicates/removeduplicates_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/framework/plugins/removeduplicates/removeduplicates_test.go b/pkg/framework/plugins/removeduplicates/removeduplicates_test.go index 15e9bb927..775611e64 100644 --- a/pkg/framework/plugins/removeduplicates/removeduplicates_test.go +++ b/pkg/framework/plugins/removeduplicates/removeduplicates_test.go @@ -144,8 +144,15 @@ func TestFindDuplicatePods(t *testing.T) { Image: "foo", }) }) - p15 := test.BuildTestPod("p15", 100, 0, node1.Name, nil) - p15.Namespace = "node-fit" + // ### Pods Evictable Based On Node Fit ### + ownerRef3 := test.GetReplicaSetOwnerRefList() + p15 := test.BuildTestPod("p15", 100, 0, node1.Name, func(pod *v1.Pod) { + pod.Namespace = "node-fit" + pod.ObjectMeta.OwnerReferences = ownerRef3 + pod.Spec.NodeSelector = map[string]string{ + "datacenter": "west", + } + }) p16 := test.BuildTestPod("NOT1", 100, 0, node1.Name, nil) p16.Namespace = "node-fit" p17 := test.BuildTestPod("NOT2", 100, 0, node1.Name, nil) @@ -165,17 +172,10 @@ func TestFindDuplicatePods(t *testing.T) { // ### Non-evictable Pods ### - // ### Pods Evictable Based On Node Fit ### - - ownerRef3 := test.GetReplicaSetOwnerRefList() - p15.ObjectMeta.OwnerReferences = ownerRef3 p16.ObjectMeta.OwnerReferences = ownerRef3 p17.ObjectMeta.OwnerReferences = ownerRef3 p18.ObjectMeta.OwnerReferences = ownerRef3 - p15.Spec.NodeSelector = map[string]string{ - "datacenter": "west", - } p16.Spec.NodeSelector = map[string]string{ "datacenter": "west", }