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