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 16:04:32 +01:00
parent 70a71f54bc
commit 1d7368b58d

View File

@@ -70,11 +70,6 @@ func TestPodLifeTime(t *testing.T) {
})
}
// Setup two old pods with different labels
p13 := buildTestPodWithRSOwnerRefForNode1("p13", olderPodCreationTime, func(pod *v1.Pod) {
pod.ObjectMeta.Labels = map[string]string{"foo": "bar1"}
})
p14 := buildTestPodWithRSOwnerRefForNode1("p14", olderPodCreationTime, func(pod *v1.Pod) {
pod.DeletionTimestamp = &metav1.Time{}
})
@@ -259,7 +254,9 @@ func TestPodLifeTime(t *testing.T) {
buildTestPodWithRSOwnerRefForNode1("p12", olderPodCreationTime, func(pod *v1.Pod) {
pod.ObjectMeta.Labels = map[string]string{"foo": "bar"}
}),
p13,
buildTestPodWithRSOwnerRefForNode1("p13", olderPodCreationTime, func(pod *v1.Pod) {
pod.ObjectMeta.Labels = map[string]string{"foo": "bar1"}
}),
},
nodes: []*v1.Node{buildTestNode1()},
expectedEvictedPodCount: 1,