From ea80f7d3075384ba756a42ac735b8e27c92f7296 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Mon, 15 Dec 2025 13:23:46 +0100 Subject: [PATCH] refactor(TestPodAntiAffinity): ensure p10 is created only through apply argument --- .../pod_antiaffinity_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go index 9cab9b4af..ed373090c 100644 --- a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go +++ b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go @@ -109,9 +109,12 @@ func TestPodAntiAffinity(t *testing.T) { test.SetPodAntiAffinity(pod, "foo", "bar") pod.DeletionTimestamp = &metav1.Time{} }) - p10 := buildTestPodForNode1("p10", nil) + p10 := buildTestPodForNode1("p10", func(pod *v1.Pod) { + test.SetNormalOwnerRef(pod) + test.SetPodAntiAffinity(pod, "foo", "bar") + pod.DeletionTimestamp = &metav1.Time{} + }) p11 := buildTestPod("p11", nodeName5, nil) - p10.DeletionTimestamp = &metav1.Time{} criticalPriority := utils.SystemCriticalPriority nonEvictablePod := buildTestPodForNode1("non-evict", func(pod *v1.Pod) { @@ -119,12 +122,8 @@ func TestPodAntiAffinity(t *testing.T) { }) p11.Labels = map[string]string{"foo": "bar"} nonEvictablePod.Labels = map[string]string{"foo": "bar"} - test.SetNormalOwnerRef(p10) test.SetNormalOwnerRef(p11) - // set pod anti affinity - test.SetPodAntiAffinity(p10, "foo", "bar") - var uint1 uint = 1 var uint3 uint = 3