From ad872f8b771ba4fbb2a3c82d7f9044f3ba0d17a7 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Mon, 15 Dec 2025 13:54:40 +0100 Subject: [PATCH] refactor(TestPodAntiAffinity): inline p8 --- .../pod_antiaffinity_test.go | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go index cde80394c..42059cf19 100644 --- a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go +++ b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go @@ -117,11 +117,6 @@ func buildTestPodNonEvictableForNode1() *v1.Pod { func TestPodAntiAffinity(t *testing.T) { - p8 := buildTestPodForNode1("p8", func(pod *v1.Pod) { - pod.Spec.NodeSelector = map[string]string{ - "datacenter": "west", - } - }) p9 := buildTestPodForNode1("p9", func(pod *v1.Pod) { test.SetNormalOwnerRef(pod) setPodAntiAffinityFooBar(pod) @@ -255,7 +250,13 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Won't evict pods because node selectors don't match available nodes", maxPodsToEvictPerNode: &uint1, - pods: []*v1.Pod{p8, nonEvictablePod}, + pods: []*v1.Pod{ + buildTestPodForNode1("p8", func(pod *v1.Pod) { + pod.Spec.NodeSelector = map[string]string{ + "datacenter": "west", + } + }), + nonEvictablePod}, nodes: []*v1.Node{ buildTestNode1(), buildTestNode(nodeName2, func(node *v1.Node) { @@ -270,7 +271,13 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Won't evict pods because only other node is not schedulable", maxPodsToEvictPerNode: &uint1, - pods: []*v1.Pod{p8, nonEvictablePod}, + pods: []*v1.Pod{ + buildTestPodForNode1("p8", func(pod *v1.Pod) { + pod.Spec.NodeSelector = map[string]string{ + "datacenter": "west", + } + }), + nonEvictablePod}, nodes: []*v1.Node{ buildTestNode1(), buildTestNode(nodeName3, func(node *v1.Node) {