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

PodLifeTime: support CrashLoopBackOff container state

This commit is contained in:
Amir Alavi
2023-06-06 18:15:54 -04:00
parent 877d9b18ee
commit 1b976529bc
2 changed files with 13 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import (
"testing"
v1 "k8s.io/api/core/v1"
utilpointer "k8s.io/utils/pointer"
)
func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
@@ -31,7 +32,7 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
{
description: "valid arg, no errors",
args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: func(i uint) *uint { return &i }(1),
MaxPodLifeTimeSeconds: utilpointer.Uint(1),
States: []string{string(v1.PodRunning)},
},
expectError: false,
@@ -50,6 +51,14 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
},
expectError: true,
},
{
description: "allows CrashLoopBackOff state",
args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: utilpointer.Uint(1),
States: []string{"CrashLoopBackOff"},
},
expectError: false,
},
}
for _, tc := range testCases {