1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 05:14:13 +01:00

refactor(TestFindDuplicatePods): have a pod fully created through BuildTestPod without any edits

This commit is contained in:
Jan Chaloupka
2025-12-14 12:27:41 +01:00
parent 3d4263bf5e
commit 511ed214b0

View File

@@ -85,7 +85,21 @@ func TestFindDuplicatePods(t *testing.T) {
p4 := test.BuildTestPod("p4", 100, 0, node1.Name, func(pod *v1.Pod) {
pod.ObjectMeta.OwnerReferences = test.GetDaemonSetOwnerRefList()
})
p5 := test.BuildTestPod("p5", 100, 0, node1.Name, nil)
// A Pod with local storage.
p5 := test.BuildTestPod("p5", 100, 0, node1.Name, func(pod *v1.Pod) {
pod.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
pod.Spec.Volumes = []v1.Volume{
{
Name: "sample",
VolumeSource: v1.VolumeSource{
HostPath: &v1.HostPathVolumeSource{Path: "somePath"},
EmptyDir: &v1.EmptyDirVolumeSource{
SizeLimit: resource.NewQuantity(int64(10), resource.BinarySI),
},
},
},
}
})
p6 := test.BuildTestPod("p6", 100, 0, node1.Name, nil)
p7 := test.BuildTestPod("p7", 100, 0, node1.Name, nil)
p7.Namespace = "kube-system"
@@ -130,20 +144,6 @@ func TestFindDuplicatePods(t *testing.T) {
// ### Non-evictable Pods ###
// A Pod with local storage.
p5.ObjectMeta.OwnerReferences = test.GetNormalPodOwnerRefList()
p5.Spec.Volumes = []v1.Volume{
{
Name: "sample",
VolumeSource: v1.VolumeSource{
HostPath: &v1.HostPathVolumeSource{Path: "somePath"},
EmptyDir: &v1.EmptyDirVolumeSource{
SizeLimit: resource.NewQuantity(int64(10), resource.BinarySI),
},
},
},
}
// A Mirror Pod.
p6.Annotations = test.GetMirrorPodAnnotation()