1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 05:14:13 +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:55:12 +01:00
parent bed39d70f0
commit 9be42e50cc

View File

@@ -61,9 +61,6 @@ func TestPodLifeTime(t *testing.T) {
})
}
// Setup pods, zero should be evicted
p8 := buildTestPodForNode1("p8", metav1.NewTime(time.Now().Add(-time.Second*595)), nil)
// Setup two old pods with different status phases
p9 := buildTestPodWithRSOwnerRefForNode1("p9", olderPodCreationTime, func(pod *v1.Pod) {
pod.Status.Phase = "Pending"
@@ -157,7 +154,7 @@ func TestPodLifeTime(t *testing.T) {
},
pods: []*v1.Pod{
buildTestPodForNode1("p7", newerPodCreationTime, nil),
p8,
buildTestPodForNode1("p8", metav1.NewTime(time.Now().Add(-time.Second*595)), nil),
},
nodes: []*v1.Node{buildTestNode1()},
expectedEvictedPodCount: 0,