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

refactor(TestPodLifeTime): update test names to better correspond to their purpose

This commit is contained in:
Jan Chaloupka
2025-12-11 13:00:06 +01:00
parent 7e14c6c7c4
commit c77f1a4ed2

View File

@@ -192,7 +192,7 @@ func TestPodLifeTime(t *testing.T) {
expectedEvictedPodCount: 1, expectedEvictedPodCount: 1,
}, },
{ {
description: "does not evict pvc pods with ignorePvcPods set to true", description: "Does not evict pvc pods with ignorePvcPods set to true",
args: &PodLifeTimeArgs{ args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: &maxLifeTime, MaxPodLifeTimeSeconds: &maxLifeTime,
}, },
@@ -212,7 +212,7 @@ func TestPodLifeTime(t *testing.T) {
ignorePvcPods: true, ignorePvcPods: true,
}, },
{ {
description: "evicts pvc pods with ignorePvcPods set to false (or unset)", description: "Evicts pvc pods with ignorePvcPods set to false (or unset)",
args: &PodLifeTimeArgs{ args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: &maxLifeTime, MaxPodLifeTimeSeconds: &maxLifeTime,
}, },
@@ -231,7 +231,7 @@ func TestPodLifeTime(t *testing.T) {
expectedEvictedPodCount: 1, expectedEvictedPodCount: 1,
}, },
{ {
description: "No pod to evicted since all pod terminating", description: "1 pod matching label selector should be evicted",
args: &PodLifeTimeArgs{ args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: &maxLifeTime, MaxPodLifeTimeSeconds: &maxLifeTime,
LabelSelector: &metav1.LabelSelector{ LabelSelector: &metav1.LabelSelector{
@@ -455,7 +455,7 @@ func TestPodLifeTime(t *testing.T) {
}, },
pods: []*v1.Pod{ pods: []*v1.Pod{
buildTestPodWithRSOwnerRefWithPendingPhaseForNode1("p9", olderPodCreationTime, func(pod *v1.Pod) { buildTestPodWithRSOwnerRefWithPendingPhaseForNode1("p9", olderPodCreationTime, func(pod *v1.Pod) {
pod.Status.InitContainerStatuses = []v1.ContainerStatus{ pod.Status.EphemeralContainerStatuses = []v1.ContainerStatus{
{ {
State: v1.ContainerState{ State: v1.ContainerState{
Waiting: &v1.ContainerStateWaiting{Reason: "CreateContainerError"}, Waiting: &v1.ContainerStateWaiting{Reason: "CreateContainerError"},
@@ -599,7 +599,7 @@ func TestPodLifeTime(t *testing.T) {
expectedEvictedPodCount: 1, expectedEvictedPodCount: 1,
}, },
{ {
description: "1 pod with pod status phase v1.PodUnknown should be evicted", description: "1 pod with pod status phase v1.PodFailed should be evicted",
args: &PodLifeTimeArgs{ args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: &maxLifeTime, MaxPodLifeTimeSeconds: &maxLifeTime,
States: []string{string(v1.PodFailed)}, States: []string{string(v1.PodFailed)},
@@ -627,7 +627,7 @@ func TestPodLifeTime(t *testing.T) {
expectedEvictedPodCount: 1, expectedEvictedPodCount: 1,
}, },
{ {
description: "1 pod without ImagePullBackOff States should be ignored", description: "1 pod with ImagePullBackOff status should be ignored when States filter is ContainerCreating",
args: &PodLifeTimeArgs{ args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: &maxLifeTime, MaxPodLifeTimeSeconds: &maxLifeTime,
States: []string{"ContainerCreating"}, States: []string{"ContainerCreating"},