From bed39d70f08ffd43b8a79fbad247960e22fe9220 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Wed, 10 Dec 2025 15:54:04 +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 def94dfdf..20dc6c1e3 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, zero should be evicted - p7 := buildTestPodForNode1("p7", newerPodCreationTime, nil) p8 := buildTestPodForNode1("p8", metav1.NewTime(time.Now().Add(-time.Second*595)), nil) // Setup two old pods with different status phases @@ -156,7 +155,10 @@ func TestPodLifeTime(t *testing.T) { args: &PodLifeTimeArgs{ MaxPodLifeTimeSeconds: &maxLifeTime, }, - pods: []*v1.Pod{p7, p8}, + pods: []*v1.Pod{ + buildTestPodForNode1("p7", newerPodCreationTime, nil), + p8, + }, nodes: []*v1.Node{buildTestNode1()}, expectedEvictedPodCount: 0, },