1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

fix(unit-test): add necessary ownerRef to the pod.

This commit is contained in:
zhifei92
2024-06-21 19:12:40 +08:00
parent cdbd101eae
commit ae15fed7e7
4 changed files with 31 additions and 8 deletions

View File

@@ -110,6 +110,12 @@ func TestDeletePodsViolatingNodeTaints(t *testing.T) {
p4 := test.BuildTestPod("p4", 100, 0, node1.Name, nil)
p5 := test.BuildTestPod("p5", 100, 0, node1.Name, nil)
p6 := test.BuildTestPod("p6", 100, 0, node1.Name, nil)
p7 := test.BuildTestPod("p7", 100, 0, node2.Name, nil)
p8 := test.BuildTestPod("p8", 100, 0, node2.Name, nil)
p9 := test.BuildTestPod("p9", 100, 0, node2.Name, nil)
p10 := test.BuildTestPod("p10", 100, 0, node2.Name, nil)
p11 := test.BuildTestPod("p11", 100, 0, node2.Name, nil)
p12 := test.BuildTestPod("p11", 100, 0, node2.Name, nil)
p1.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p2.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
@@ -117,13 +123,11 @@ func TestDeletePodsViolatingNodeTaints(t *testing.T) {
p4.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p5.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p6.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p7 := test.BuildTestPod("p7", 100, 0, node2.Name, nil)
p8 := test.BuildTestPod("p8", 100, 0, node2.Name, nil)
p9 := test.BuildTestPod("p9", 100, 0, node2.Name, nil)
p10 := test.BuildTestPod("p10", 100, 0, node2.Name, nil)
p11 := test.BuildTestPod("p11", 100, 0, node2.Name, nil)
p7.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p8.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p9.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p10.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p11.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p12 := test.BuildTestPod("p11", 100, 0, node2.Name, nil)
p12.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
// The following 4 pods won't get evicted.