1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +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:05:01 +01:00
parent 1d7368b58d
commit 822a1d4c40

View File

@@ -70,9 +70,6 @@ func TestPodLifeTime(t *testing.T) {
})
}
p14 := buildTestPodWithRSOwnerRefForNode1("p14", olderPodCreationTime, func(pod *v1.Pod) {
pod.DeletionTimestamp = &metav1.Time{}
})
p15 := buildTestPodWithRSOwnerRefForNode1("p15", olderPodCreationTime, func(pod *v1.Pod) {
pod.DeletionTimestamp = &metav1.Time{}
})
@@ -269,7 +266,12 @@ func TestPodLifeTime(t *testing.T) {
MatchLabels: map[string]string{"foo": "bar"},
},
},
pods: []*v1.Pod{p14, p15},
pods: []*v1.Pod{
buildTestPodWithRSOwnerRefForNode1("p14", olderPodCreationTime, func(pod *v1.Pod) {
pod.DeletionTimestamp = &metav1.Time{}
}),
p15,
},
nodes: []*v1.Node{buildTestNode1()},
expectedEvictedPodCount: 0,
},