diff --git a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go index 1b6affa2d..3a09d8af1 100644 --- a/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go +++ b/pkg/framework/plugins/removepodsviolatinginterpodantiaffinity/pod_antiaffinity_test.go @@ -33,18 +33,22 @@ import ( "sigs.k8s.io/descheduler/test" ) +func buildTestNode(name string, apply func(*v1.Node)) *v1.Node { + return test.BuildTestNode(name, 2000, 3000, 10, apply) +} + func TestPodAntiAffinity(t *testing.T) { - node1 := test.BuildTestNode("n1", 2000, 3000, 10, func(node *v1.Node) { + node1 := buildTestNode("n1", func(node *v1.Node) { node.ObjectMeta.Labels = map[string]string{ "region": "main-region", } }) - node2 := test.BuildTestNode("n2", 2000, 3000, 10, func(node *v1.Node) { + node2 := buildTestNode("n2", func(node *v1.Node) { node.ObjectMeta.Labels = map[string]string{ "datacenter": "east", } }) - node3 := test.BuildTestNode("n3", 2000, 3000, 10, func(node *v1.Node) { + node3 := buildTestNode("n3", func(node *v1.Node) { node.Spec = v1.NodeSpec{ Unschedulable: true, }