1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 14:41:10 +01:00

refactor(TestFindDuplicatePods): inline p12 pod creation

This commit is contained in:
Jan Chaloupka
2025-12-14 14:19:19 +01:00
parent 1c494f9c44
commit 4e758c18e8

View File

@@ -98,9 +98,6 @@ func TestFindDuplicatePods(t *testing.T) {
// A Critical Pod. // A Critical Pod.
// Three Pods in the "test" Namespace, bound to same ReplicaSet. 2 should be evicted. // Three Pods in the "test" Namespace, bound to same ReplicaSet. 2 should be evicted.
// Same owners, but different images // Same owners, but different images
p12 := buildTestPodWithRSOwnerRefWithNamespaceForNode1("p12", "different-images", func(pod *v1.Pod) {
pod.Spec.Containers[0].Image = "bar"
})
// Multiple containers // Multiple containers
p13 := buildTestPodWithRSOwnerRefWithNamespaceForNode1("p13", "different-images", func(pod *v1.Pod) { p13 := buildTestPodWithRSOwnerRefWithNamespaceForNode1("p13", "different-images", func(pod *v1.Pod) {
pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{ pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{
@@ -266,7 +263,11 @@ func TestFindDuplicatePods(t *testing.T) {
pods: []*v1.Pod{ pods: []*v1.Pod{
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p11", "different-images", func(pod *v1.Pod) { buildTestPodWithRSOwnerRefWithNamespaceForNode1("p11", "different-images", func(pod *v1.Pod) {
pod.Spec.Containers[0].Image = "foo" pod.Spec.Containers[0].Image = "foo"
}), p12}, }),
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p12", "different-images", func(pod *v1.Pod) {
pod.Spec.Containers[0].Image = "bar"
}),
},
nodes: []*v1.Node{node1, node2}, nodes: []*v1.Node{node1, node2},
expectedEvictedPodCount: 0, expectedEvictedPodCount: 0,
}, },