From 9b50aa91f8de1fabb32fbcf352b4b2a204874f94 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Sun, 14 Dec 2025 13:44:24 +0100 Subject: [PATCH] refactor(TestFindDuplicatePods): inline p4 pod creation --- .../removeduplicates/removeduplicates_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/framework/plugins/removeduplicates/removeduplicates_test.go b/pkg/framework/plugins/removeduplicates/removeduplicates_test.go index d52941bad..bcf836d80 100644 --- a/pkg/framework/plugins/removeduplicates/removeduplicates_test.go +++ b/pkg/framework/plugins/removeduplicates/removeduplicates_test.go @@ -93,9 +93,6 @@ func TestFindDuplicatePods(t *testing.T) { // Three Pods in the "dev" Namespace, bound to same ReplicaSet. 2 should be evicted. // A DaemonSet. - p4 := buildTestPodForNode1("p4", func(pod *v1.Pod) { - test.SetDSOwnerRef(pod) - }) // A Pod with local storage. p5 := buildTestPodForNode1("p5", func(pod *v1.Pod) { test.SetNormalOwnerRef(pod) @@ -217,8 +214,13 @@ func TestFindDuplicatePods(t *testing.T) { expectedEvictedPodCount: 2, }, { - description: "Pods are: part of DaemonSet, with local storage, mirror pod annotation, critical pod annotation - none should be evicted.", - pods: []*v1.Pod{p4, p5, p6, p7}, + description: "Pods are: part of DaemonSet, with local storage, mirror pod annotation, critical pod annotation - none should be evicted.", + pods: []*v1.Pod{ + buildTestPodForNode1("p4", func(pod *v1.Pod) { + test.SetDSOwnerRef(pod) + }), + p5, p6, p7, + }, nodes: []*v1.Node{node1, node2}, expectedEvictedPodCount: 0, }, @@ -228,7 +230,10 @@ func TestFindDuplicatePods(t *testing.T) { buildTestPodWithRSOwnerRefWithNamespaceForNode1("p1", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p2", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p3", "dev", nil), - p4, p5, p6, p7, p8, p9, p10, + buildTestPodForNode1("p4", func(pod *v1.Pod) { + test.SetDSOwnerRef(pod) + }), + p5, p6, p7, p8, p9, p10, }, nodes: []*v1.Node{node1, node2}, expectedEvictedPodCount: 2,