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

refactor(TestPodLifeTime): inline pod creation in each unit test to avoid accidental pod spec updates

This commit is contained in:
Jan Chaloupka
2025-12-10 16:02:14 +01:00
parent c707f53cec
commit 41a0a9c994

View File

@@ -70,11 +70,6 @@ func TestPodLifeTime(t *testing.T) {
})
}
// Setup two old pods with different status phases
p10 := buildTestPodWithRSOwnerRefForNode1("p10", olderPodCreationTime, func(pod *v1.Pod) {
pod.Status.Phase = "Running"
})
p11 := buildTestPodWithRSOwnerRefForNode1("p11", olderPodCreationTime, func(pod *v1.Pod) {
pod.Spec.Volumes = []v1.Volume{
{
@@ -219,7 +214,9 @@ func TestPodLifeTime(t *testing.T) {
},
pods: []*v1.Pod{
buildTestPodWithRSOwnerRefWithPendingPhaseForNode1("p9", olderPodCreationTime, nil),
p10,
buildTestPodWithRSOwnerRefForNode1("p10", olderPodCreationTime, func(pod *v1.Pod) {
pod.Status.Phase = "Running"
}),
},
nodes: []*v1.Node{buildTestNode1()},
expectedEvictedPodCount: 1,