mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 06:29:29 +01:00
refactor(TestPodLifeTime): inline pod creation in each unit test to avoid accidental pod spec updates
This commit is contained in:
@@ -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
|
// Setup two old pods with different status phases
|
||||||
p9 := buildTestPodWithRSOwnerRefForNode1("p9", olderPodCreationTime, func(pod *v1.Pod) {
|
p9 := buildTestPodWithRSOwnerRefForNode1("p9", olderPodCreationTime, func(pod *v1.Pod) {
|
||||||
pod.Status.Phase = "Pending"
|
pod.Status.Phase = "Pending"
|
||||||
@@ -157,7 +154,7 @@ func TestPodLifeTime(t *testing.T) {
|
|||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
buildTestPodForNode1("p7", newerPodCreationTime, nil),
|
buildTestPodForNode1("p7", newerPodCreationTime, nil),
|
||||||
p8,
|
buildTestPodForNode1("p8", metav1.NewTime(time.Now().Add(-time.Second*595)), nil),
|
||||||
},
|
},
|
||||||
nodes: []*v1.Node{buildTestNode1()},
|
nodes: []*v1.Node{buildTestNode1()},
|
||||||
expectedEvictedPodCount: 0,
|
expectedEvictedPodCount: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user