From 822a1d4c4034e77ea77bdde5cdcfcfd40c9659b2 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Wed, 10 Dec 2025 16:05:01 +0100 Subject: [PATCH] refactor(TestPodLifeTime): inline pod creation in each unit test to avoid accidental pod spec updates --- pkg/framework/plugins/podlifetime/pod_lifetime_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/framework/plugins/podlifetime/pod_lifetime_test.go b/pkg/framework/plugins/podlifetime/pod_lifetime_test.go index b43ce56c1..65d70f811 100644 --- a/pkg/framework/plugins/podlifetime/pod_lifetime_test.go +++ b/pkg/framework/plugins/podlifetime/pod_lifetime_test.go @@ -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, },