From 1d7368b58da6d7303a895a190cbb619557df344c Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Wed, 10 Dec 2025 16:04:32 +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 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/framework/plugins/podlifetime/pod_lifetime_test.go b/pkg/framework/plugins/podlifetime/pod_lifetime_test.go index df0cd182d..b43ce56c1 100644 --- a/pkg/framework/plugins/podlifetime/pod_lifetime_test.go +++ b/pkg/framework/plugins/podlifetime/pod_lifetime_test.go @@ -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,