1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-25 20:59:28 +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 15:54:04 +01:00
parent 8a0fd10315
commit bed39d70f0

View File

@@ -62,7 +62,6 @@ func TestPodLifeTime(t *testing.T) {
}
// Setup pods, zero should be evicted
p7 := buildTestPodForNode1("p7", newerPodCreationTime, nil)
p8 := buildTestPodForNode1("p8", metav1.NewTime(time.Now().Add(-time.Second*595)), nil)
// Setup two old pods with different status phases
@@ -156,7 +155,10 @@ func TestPodLifeTime(t *testing.T) {
args: &PodLifeTimeArgs{
MaxPodLifeTimeSeconds: &maxLifeTime,
},
pods: []*v1.Pod{p7, p8},
pods: []*v1.Pod{
buildTestPodForNode1("p7", newerPodCreationTime, nil),
p8,
},
nodes: []*v1.Node{buildTestNode1()},
expectedEvictedPodCount: 0,
},