From cf79af6fbafc2986d4bbb0c3e8a93938c826e0d8 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Mon, 15 Dec 2025 13:19:38 +0100 Subject: [PATCH] refactor(TestPodAntiAffinity): ensure p3 is created only through apply argument --- .../pod_antiaffinity_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go index 12c5f24a9..041fa2577 100644 --- a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go +++ b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go @@ -73,7 +73,10 @@ func TestPodAntiAffinity(t *testing.T) { test.SetNormalOwnerRef(pod) pod.Labels = map[string]string{"foo": "bar"} }) - p3 := buildTestPodForNode1("p3", nil) + p3 := buildTestPodForNode1("p3", func(pod *v1.Pod) { + test.SetNormalOwnerRef(pod) + test.SetPodAntiAffinity(pod, "foo", "bar") + }) p4 := buildTestPodForNode1("p4", nil) p5 := buildTestPodForNode1("p5", nil) p6 := buildTestPodForNode1("p6", nil) @@ -94,7 +97,6 @@ func TestPodAntiAffinity(t *testing.T) { p7.Labels = map[string]string{"foo1": "bar1"} p11.Labels = map[string]string{"foo": "bar"} nonEvictablePod.Labels = map[string]string{"foo": "bar"} - test.SetNormalOwnerRef(p3) test.SetNormalOwnerRef(p4) test.SetNormalOwnerRef(p5) test.SetNormalOwnerRef(p6) @@ -104,7 +106,6 @@ func TestPodAntiAffinity(t *testing.T) { test.SetNormalOwnerRef(p11) // set pod anti affinity - test.SetPodAntiAffinity(p3, "foo", "bar") test.SetPodAntiAffinity(p4, "foo", "bar") test.SetPodAntiAffinity(p5, "foo1", "bar1") test.SetPodAntiAffinity(p6, "foo1", "bar1")