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

Critical pod annotation scheduler.alpha.kubernetes.io/critical-pod has been drop, no need to set it anymore in the tests

This commit is contained in:
Jan Chaloupka
2020-02-07 15:46:28 +01:00
parent e2a23f2848
commit d065f9904b
5 changed files with 20 additions and 18 deletions

View File

@@ -17,11 +17,11 @@ limitations under the License.
package pod
import (
"sigs.k8s.io/descheduler/pkg/utils"
"testing"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/descheduler/pkg/utils"
"sigs.k8s.io/descheduler/test"
)
@@ -150,15 +150,19 @@ func TestIsEvictable(t *testing.T) {
}, {
pod: test.BuildTestPod("p12", 400, 0, n1.Name),
runBefore: func(pod *v1.Pod) {
pod.Annotations = test.GetCriticalPodAnnotation()
priority := utils.SystemCriticalPriority
pod.Spec.Priority = &priority
},
evictLocalStoragePods: false,
result: false,
}, {
pod: test.BuildTestPod("p13", 400, 0, n1.Name),
runBefore: func(pod *v1.Pod) {
pod.Annotations = test.GetCriticalPodAnnotation()
pod.Annotations["descheduler.alpha.kubernetes.io/evict"] = "true"
priority := utils.SystemCriticalPriority
pod.Spec.Priority = &priority
pod.Annotations = map[string]string{
"descheduler.alpha.kubernetes.io/evict": "true",
}
},
evictLocalStoragePods: false,
result: true,
@@ -208,7 +212,8 @@ func TestPodTypes(t *testing.T) {
p4.Annotations = test.GetMirrorPodAnnotation()
// A Critical Pod.
p5.Namespace = "kube-system"
p5.Annotations = test.GetCriticalPodAnnotation()
priority := utils.SystemCriticalPriority
p5.Spec.Priority = &priority
systemCriticalPriority := utils.SystemCriticalPriority
p5.Spec.Priority = &systemCriticalPriority
if !IsMirrorPod(p4) {

View File

@@ -85,7 +85,8 @@ func TestFindDuplicatePods(t *testing.T) {
p6.Annotations = test.GetMirrorPodAnnotation()
// A Critical Pod.
p7.Annotations = test.GetCriticalPodAnnotation()
priority := utils.SystemCriticalPriority
p7.Spec.Priority = &priority
testCases := []struct {
description string

View File

@@ -21,12 +21,13 @@ import (
"strings"
"testing"
"reflect"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/fake"
core "k8s.io/client-go/testing"
"reflect"
"sigs.k8s.io/descheduler/pkg/api"
"sigs.k8s.io/descheduler/pkg/utils"
"sigs.k8s.io/descheduler/test"
@@ -81,7 +82,8 @@ func TestLowNodeUtilizationWithoutPriority(t *testing.T) {
p7.Annotations = test.GetMirrorPodAnnotation()
// A Critical Pod.
p8.Namespace = "kube-system"
p8.Annotations = test.GetCriticalPodAnnotation()
priority := utils.SystemCriticalPriority
p8.Spec.Priority = &priority
p9 := test.BuildTestPod("p9", 400, 0, n1.Name)
p9.ObjectMeta.OwnerReferences = test.GetReplicaSetOwnerRefList()
fakeClient := &fake.Clientset{}
@@ -186,7 +188,8 @@ func TestLowNodeUtilizationWithPriorities(t *testing.T) {
p7.Annotations = test.GetMirrorPodAnnotation()
// A Critical Pod.
p8.Namespace = "kube-system"
p8.Annotations = test.GetCriticalPodAnnotation()
priority := utils.SystemCriticalPriority
p8.Spec.Priority = &priority
p9 := test.BuildTestPod("p9", 400, 0, n1.Name)
p9.ObjectMeta.OwnerReferences = test.GetReplicaSetOwnerRefList()
fakeClient := &fake.Clientset{}

View File

@@ -70,7 +70,8 @@ func TestDeletePodsViolatingNodeTaints(t *testing.T) {
// The following 4 pods won't get evicted.
// A Critical Pod.
p7.Namespace = "kube-system"
p7.Annotations = test.GetCriticalPodAnnotation()
priority := utils.SystemCriticalPriority
p7.Spec.Priority = &priority
// A daemonset.
p8.ObjectMeta.OwnerReferences = test.GetDaemonSetOwnerRefList()