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:
@@ -135,8 +135,15 @@ func TestFindDuplicatePods(t *testing.T) {
|
|||||||
pod.Spec.Containers[0].Image = "bar"
|
pod.Spec.Containers[0].Image = "bar"
|
||||||
pod.ObjectMeta.OwnerReferences = ownerRef1
|
pod.ObjectMeta.OwnerReferences = ownerRef1
|
||||||
})
|
})
|
||||||
p13 := test.BuildTestPod("p13", 100, 0, node1.Name, nil)
|
// Multiple containers
|
||||||
p13.Namespace = "different-images"
|
p13 := test.BuildTestPod("p13", 100, 0, node1.Name, func(pod *v1.Pod) {
|
||||||
|
pod.Namespace = "different-images"
|
||||||
|
pod.ObjectMeta.OwnerReferences = ownerRef1
|
||||||
|
pod.Spec.Containers = append(pod.Spec.Containers, v1.Container{
|
||||||
|
Name: "foo",
|
||||||
|
Image: "foo",
|
||||||
|
})
|
||||||
|
})
|
||||||
p14 := test.BuildTestPod("p14", 100, 0, node1.Name, nil)
|
p14 := test.BuildTestPod("p14", 100, 0, node1.Name, nil)
|
||||||
p14.Namespace = "different-images"
|
p14.Namespace = "different-images"
|
||||||
p15 := test.BuildTestPod("p15", 100, 0, node1.Name, nil)
|
p15 := test.BuildTestPod("p15", 100, 0, node1.Name, nil)
|
||||||
@@ -160,13 +167,6 @@ func TestFindDuplicatePods(t *testing.T) {
|
|||||||
|
|
||||||
// ### Non-evictable Pods ###
|
// ### Non-evictable Pods ###
|
||||||
|
|
||||||
// Multiple containers
|
|
||||||
p13.ObjectMeta.OwnerReferences = ownerRef1
|
|
||||||
p13.Spec.Containers = append(p13.Spec.Containers, v1.Container{
|
|
||||||
Name: "foo",
|
|
||||||
Image: "foo",
|
|
||||||
})
|
|
||||||
|
|
||||||
// ### Pods Evictable Based On Node Fit ###
|
// ### Pods Evictable Based On Node Fit ###
|
||||||
|
|
||||||
ownerRef3 := test.GetReplicaSetOwnerRefList()
|
ownerRef3 := test.GetReplicaSetOwnerRefList()
|
||||||
|
|||||||
Reference in New Issue
Block a user