1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 14:41:10 +01:00

Drop assignment if default test values

This commit is contained in:
Jan Chaloupka
2025-07-23 10:31:14 +02:00
parent bf6a51f733
commit 5cc9e68127

View File

@@ -90,10 +90,7 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false,
nodeFit: true,
result: false,
}, { }, {
description: "Pod with correct tolerations running on normal node, all other nodes tainted", description: "Pod with correct tolerations running on normal node, all other nodes tainted",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -128,10 +125,8 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false, result: true,
nodeFit: true,
result: true,
}, { }, {
description: "Pod with incorrect node selector", description: "Pod with incorrect node selector",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -154,10 +149,7 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false,
nodeFit: true,
result: false,
}, { }, {
description: "Pod with correct node selector", description: "Pod with correct node selector",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -180,10 +172,8 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false, result: true,
nodeFit: true,
result: true,
}, { }, {
description: "Pod with correct node selector, but only available node doesn't have enough CPU", description: "Pod with correct node selector, but only available node doesn't have enough CPU",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -206,10 +196,7 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false,
nodeFit: true,
result: false,
}, { }, {
description: "Pod with correct node selector, and one node has enough memory", description: "Pod with correct node selector, and one node has enough memory",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -242,10 +229,8 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false, result: true,
nodeFit: true,
result: true,
}, { }, {
description: "Pod with correct node selector, but both nodes don't have enough memory", description: "Pod with correct node selector, but both nodes don't have enough memory",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -278,10 +263,7 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false,
nodeFit: true,
result: false,
}, { }, {
description: "Pod with incorrect node selector, but nodefit false, should still be evicted", description: "Pod with incorrect node selector, but nodefit false, should still be evicted",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -304,10 +286,7 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
nodeFit: false,
result: true,
}, },
} }
@@ -349,13 +328,10 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Status.Phase = v1.PodFailed pod.Status.Phase = v1.PodFailed
}), }),
}, },
evictFailedBarePods: false,
result: false,
}, { }, {
description: "Normal pod eviction with no ownerRefs and evictFailedBarePods enabled", description: "Normal pod eviction with no ownerRefs and evictFailedBarePods enabled",
pods: []*v1.Pod{test.BuildTestPod("bare_pod", 400, 0, n1.Name, nil)}, pods: []*v1.Pod{test.BuildTestPod("bare_pod", 400, 0, n1.Name, nil)},
evictFailedBarePods: true, evictFailedBarePods: true,
result: false,
}, { }, {
description: "Failed pod eviction with no ownerRefs", description: "Failed pod eviction with no ownerRefs",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -372,9 +348,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Normal pod eviction with normal ownerRefs and descheduler.alpha.kubernetes.io/evict annotation", description: "Normal pod eviction with normal ownerRefs and descheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -383,9 +357,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Normal pod eviction with replicaSet ownerRefs", description: "Normal pod eviction with replicaSet ownerRefs",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -393,9 +365,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Normal pod eviction with replicaSet ownerRefs and descheduler.alpha.kubernetes.io/evict annotation", description: "Normal pod eviction with replicaSet ownerRefs and descheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -404,9 +374,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetReplicaSetOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetReplicaSetOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Normal pod eviction with statefulSet ownerRefs", description: "Normal pod eviction with statefulSet ownerRefs",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -414,9 +382,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Normal pod eviction with statefulSet ownerRefs and descheduler.alpha.kubernetes.io/evict annotation", description: "Normal pod eviction with statefulSet ownerRefs and descheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -425,9 +391,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetStatefulSetOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetStatefulSetOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Pod not evicted because it is bound to a PV and evictLocalStoragePods = false", description: "Pod not evicted because it is bound to a PV and evictLocalStoragePods = false",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -446,9 +410,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: false,
result: false,
}, { }, {
description: "Pod is evicted because it is bound to a PV and evictLocalStoragePods = true", description: "Pod is evicted because it is bound to a PV and evictLocalStoragePods = true",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -467,9 +428,8 @@ func TestDefaultEvictorFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: true, evictLocalStoragePods: true,
evictSystemCriticalPods: false, result: true,
result: true,
}, { }, {
description: "Pod is evicted because it is bound to a PV and evictLocalStoragePods = false, but it has scheduler.alpha.kubernetes.io/evict annotation", description: "Pod is evicted because it is bound to a PV and evictLocalStoragePods = false, but it has scheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -489,9 +449,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Pod not evicted because it is part of a daemonSet", description: "Pod not evicted because it is part of a daemonSet",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -500,9 +458,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetDaemonSetOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetDaemonSetOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: false,
result: false,
}, { }, {
description: "Pod is evicted because it is part of a daemonSet, but it has scheduler.alpha.kubernetes.io/evict annotation", description: "Pod is evicted because it is part of a daemonSet, but it has scheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -511,9 +466,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.ObjectMeta.OwnerReferences = test.GetDaemonSetOwnerRefList() pod.ObjectMeta.OwnerReferences = test.GetDaemonSetOwnerRefList()
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Pod not evicted because it is a mirror poddsa", description: "Pod not evicted because it is a mirror poddsa",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -522,9 +475,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Annotations = test.GetMirrorPodAnnotation() pod.Annotations = test.GetMirrorPodAnnotation()
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: false,
result: false,
}, { }, {
description: "Pod is evicted because it is a mirror pod, but it has scheduler.alpha.kubernetes.io/evict annotation", description: "Pod is evicted because it is a mirror pod, but it has scheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -534,9 +484,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Annotations["descheduler.alpha.kubernetes.io/evict"] = "true" pod.Annotations["descheduler.alpha.kubernetes.io/evict"] = "true"
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Pod not evicted because it has system critical priority", description: "Pod not evicted because it has system critical priority",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -546,9 +494,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &priority pod.Spec.Priority = &priority
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: false,
result: false,
}, { }, {
description: "Pod is evicted because it has system critical priority, but it has scheduler.alpha.kubernetes.io/evict annotation", description: "Pod is evicted because it has system critical priority, but it has scheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -561,9 +506,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, result: true,
evictSystemCriticalPods: false,
result: true,
}, { }, {
description: "Pod not evicted because it has a priority higher than the configured priority threshold", description: "Pod not evicted because it has a priority higher than the configured priority threshold",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -572,10 +515,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &highPriority pod.Spec.Priority = &highPriority
}), }),
}, },
evictLocalStoragePods: false, priorityThreshold: &lowPriority,
evictSystemCriticalPods: false,
priorityThreshold: &lowPriority,
result: false,
}, { }, {
description: "Pod is evicted because it has a priority higher than the configured priority threshold, but it has scheduler.alpha.kubernetes.io/evict annotation", description: "Pod is evicted because it has a priority higher than the configured priority threshold, but it has scheduler.alpha.kubernetes.io/evict annotation",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -585,10 +525,8 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &highPriority pod.Spec.Priority = &highPriority
}), }),
}, },
evictLocalStoragePods: false, priorityThreshold: &lowPriority,
evictSystemCriticalPods: false, result: true,
priorityThreshold: &lowPriority,
result: true,
}, { }, {
description: "Pod is evicted because it has system critical priority, but evictSystemCriticalPods = true", description: "Pod is evicted because it has system critical priority, but evictSystemCriticalPods = true",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -598,7 +536,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &priority pod.Spec.Priority = &priority
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: true, evictSystemCriticalPods: true,
result: true, result: true,
}, { }, {
@@ -611,7 +548,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &priority pod.Spec.Priority = &priority
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: true, evictSystemCriticalPods: true,
result: true, result: true,
}, { }, {
@@ -622,7 +558,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &highPriority pod.Spec.Priority = &highPriority
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: true, evictSystemCriticalPods: true,
priorityThreshold: &lowPriority, priorityThreshold: &lowPriority,
result: true, result: true,
@@ -635,7 +570,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
pod.Spec.Priority = &highPriority pod.Spec.Priority = &highPriority
}), }),
}, },
evictLocalStoragePods: false,
evictSystemCriticalPods: true, evictSystemCriticalPods: true,
priorityThreshold: &lowPriority, priorityThreshold: &lowPriority,
result: true, result: true,
@@ -666,10 +600,8 @@ func TestDefaultEvictorFilter(t *testing.T) {
} }
}), }),
}, },
evictLocalStoragePods: false, nodeFit: true,
evictSystemCriticalPods: false, result: true,
nodeFit: true,
result: true,
}, { }, {
description: "minReplicas of 2, owner with 2 replicas, evicts", description: "minReplicas of 2, owner with 2 replicas, evicts",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -697,7 +629,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
}), }),
}, },
minReplicas: 3, minReplicas: 3,
result: false,
}, { }, {
description: "minReplicas of 2, multiple owners, no eviction", description: "minReplicas of 2, multiple owners, no eviction",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -721,7 +652,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
}), }),
}, },
minPodAge: &minPodAge, minPodAge: &minPodAge,
result: false,
}, { }, {
description: "minPodAge of 50, pod created 60 minutes ago, evicts", description: "minPodAge of 50, pod created 60 minutes ago, evicts",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -754,7 +684,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
}), }),
}, },
ignorePodsWithoutPDB: true, ignorePodsWithoutPDB: true,
result: false,
}, { }, {
description: "ignorePodsWithoutPDB, pod with PDBs, evicts", description: "ignorePodsWithoutPDB, pod with PDBs, evicts",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -785,7 +714,6 @@ func TestDefaultEvictorFilter(t *testing.T) {
}), }),
}, },
ignorePvcPods: true, ignorePvcPods: true,
result: false,
}, { }, {
description: "ignorePvcPods is not set, pod with PVC, evicts", description: "ignorePvcPods is not set, pod with PVC, evicts",
pods: []*v1.Pod{ pods: []*v1.Pod{
@@ -800,8 +728,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
} }
}), }),
}, },
ignorePvcPods: false, result: true,
result: true,
}, },
} }