diff --git a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go index fcdb18093..f51c01457 100644 --- a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go +++ b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go @@ -117,7 +117,6 @@ func buildTestPodNonEvictableForNode1() *v1.Pod { func TestPodAntiAffinity(t *testing.T) { - p1 := buildTestPodP1ForNode1() p2 := buildTestPodP2ForNode1() p3 := buildTestPodP3ForNode1() p4 := buildTestPodP4ForNode1() @@ -176,7 +175,9 @@ func TestPodAntiAffinity(t *testing.T) { }{ { description: "Maximum pods to evict - 0", - pods: []*v1.Pod{p1, p2, p3, p4}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + p2, p3, p4}, nodes: []*v1.Node{ buildTestNode1(), }, @@ -185,7 +186,9 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Maximum pods to evict - 3", maxPodsToEvictPerNode: &uint3, - pods: []*v1.Pod{p1, p2, p3, p4}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + p2, p3, p4}, nodes: []*v1.Node{ buildTestNode1(), }, @@ -194,7 +197,9 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Maximum pods to evict (maxPodsToEvictPerNamespace=3) - 3", maxNoOfPodsToEvictPerNamespace: &uint3, - pods: []*v1.Pod{p1, p2, p3, p4}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + p2, p3, p4}, nodes: []*v1.Node{ buildTestNode1(), }, @@ -204,7 +209,9 @@ func TestPodAntiAffinity(t *testing.T) { description: "Maximum pods to evict (maxNoOfPodsToEvictTotal)", maxNoOfPodsToEvictPerNamespace: &uint3, maxNoOfPodsToEvictTotal: &uint1, - pods: []*v1.Pod{p1, p2, p3, p4}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + p2, p3, p4}, nodes: []*v1.Node{ buildTestNode1(), }, @@ -221,7 +228,9 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Evicts pod that conflicts with critical pod (but does not evict critical pod)", maxPodsToEvictPerNode: &uint1, - pods: []*v1.Pod{p1, nonEvictablePod}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + nonEvictablePod}, nodes: []*v1.Node{ buildTestNode1(), }, @@ -230,7 +239,9 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Evicts pod that conflicts with critical pod (but does not evict critical pod)", maxPodsToEvictPerNode: &uint1, - pods: []*v1.Pod{p1, nonEvictablePod}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + nonEvictablePod}, nodes: []*v1.Node{ buildTestNode1(), }, @@ -277,7 +288,9 @@ func TestPodAntiAffinity(t *testing.T) { { description: "Won't evict pods because only other node doesn't have enough resources", maxPodsToEvictPerNode: &uint3, - pods: []*v1.Pod{p1, p2, p3, p4}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + p2, p3, p4}, nodes: []*v1.Node{ buildTestNode1(), test.BuildTestNode(nodeName4, 2, 2, 1, nil), @@ -287,7 +300,9 @@ func TestPodAntiAffinity(t *testing.T) { }, { description: "Evict pod violating anti-affinity among different node (all pods have anti-affinity)", - pods: []*v1.Pod{p1, p11}, + pods: []*v1.Pod{ + buildTestPodP1ForNode1(), + p11}, nodes: []*v1.Node{ buildTestNode1(), test.BuildTestNode(nodeName5, 200, 3000, 10, setNodeMainRegionLabel),