From 5e6cd6057b644f44a3b2919f2f25def4c8d730fc Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Wed, 10 Dec 2025 15:52:24 +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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/framework/plugins/podlifetime/pod_lifetime_test.go b/pkg/framework/plugins/podlifetime/pod_lifetime_test.go index 266ff3803..6ac355e04 100644 --- a/pkg/framework/plugins/podlifetime/pod_lifetime_test.go +++ b/pkg/framework/plugins/podlifetime/pod_lifetime_test.go @@ -62,7 +62,6 @@ func TestPodLifeTime(t *testing.T) { } // Setup pods, one should be evicted - p5 := buildTestPodWithRSOwnerRefForNode1("p5", newerPodCreationTime, nil) p6 := buildTestPodWithRSOwnerRefForNode1("p6", metav1.NewTime(time.Now().Add(-time.Second*605)), nil) // Setup pods, zero should be evicted @@ -148,7 +147,10 @@ func TestPodLifeTime(t *testing.T) { args: &PodLifeTimeArgs{ MaxPodLifeTimeSeconds: &maxLifeTime, }, - pods: []*v1.Pod{p5, p6}, + pods: []*v1.Pod{ + buildTestPodWithRSOwnerRefForNode1("p5", newerPodCreationTime, nil), + p6, + }, nodes: []*v1.Node{buildTestNode1()}, expectedEvictedPodCount: 1, },