From 993162dd44c7b53588b3caf3d44bbc2097e8384b Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Mon, 15 Dec 2025 12:29:37 +0100 Subject: [PATCH] refactor(TestPodAntiAffinity): replace test.BuildTestNode with buildTestNode helper --- .../pod_antiaffinity_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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, }