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:53:19 +01:00
parent 5e6cd6057b
commit 8a0fd10315

View File

@@ -61,9 +61,6 @@ func TestPodLifeTime(t *testing.T) {
})
}
// Setup pods, one should be evicted
p6 := buildTestPodWithRSOwnerRefForNode1("p6", metav1.NewTime(time.Now().Add(-time.Second*605)), nil)
// Setup pods, zero should be evicted
p7 := buildTestPodForNode1("p7", newerPodCreationTime, nil)
p8 := buildTestPodForNode1("p8", metav1.NewTime(time.Now().Add(-time.Second*595)), nil)
@@ -149,7 +146,7 @@ func TestPodLifeTime(t *testing.T) {
},
pods: []*v1.Pod{
buildTestPodWithRSOwnerRefForNode1("p5", newerPodCreationTime, nil),
p6,
buildTestPodWithRSOwnerRefForNode1("p6", metav1.NewTime(time.Now().Add(-time.Second*605)), nil),
},
nodes: []*v1.Node{buildTestNode1()},
expectedEvictedPodCount: 1,