diff --git a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go index 459d75e1b..94f4b2b01 100644 --- a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go +++ b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go @@ -87,7 +87,12 @@ func TestPodAntiAffinity(t *testing.T) { test.SetPodAntiAffinity(pod, "foo1", "bar1") test.SetPodPriority(pod, 100) }) - p6 := buildTestPodForNode1("p6", nil) + p6 := buildTestPodForNode1("p6", func(pod *v1.Pod) { + test.SetNormalOwnerRef(pod) + pod.Labels = map[string]string{"foo": "bar"} + test.SetPodAntiAffinity(pod, "foo1", "bar1") + test.SetPodPriority(pod, 50) + }) p7 := buildTestPodForNode1("p7", nil) p8 := buildTestPodForNode1("p8", nil) p9 := buildTestPodForNode1("p9", nil) @@ -100,24 +105,20 @@ func TestPodAntiAffinity(t *testing.T) { nonEvictablePod := buildTestPodForNode1("non-evict", func(pod *v1.Pod) { pod.Spec.Priority = &criticalPriority }) - p6.Labels = map[string]string{"foo": "bar"} p7.Labels = map[string]string{"foo1": "bar1"} p11.Labels = map[string]string{"foo": "bar"} nonEvictablePod.Labels = map[string]string{"foo": "bar"} - test.SetNormalOwnerRef(p6) test.SetNormalOwnerRef(p7) test.SetNormalOwnerRef(p9) test.SetNormalOwnerRef(p10) test.SetNormalOwnerRef(p11) // set pod anti affinity - test.SetPodAntiAffinity(p6, "foo1", "bar1") test.SetPodAntiAffinity(p7, "foo", "bar") test.SetPodAntiAffinity(p9, "foo", "bar") test.SetPodAntiAffinity(p10, "foo", "bar") // set pod priority - test.SetPodPriority(p6, 50) test.SetPodPriority(p7, 0) // Set pod node selectors