mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
refactor(TestPodAntiAffinity): ensure p3 is created only through apply argument
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user