mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 14:41:10 +01:00
refactor(TestFindDuplicatePods): have a pod fully created through BuildTestPod without any edits
This commit is contained in:
@@ -67,8 +67,12 @@ func TestFindDuplicatePods(t *testing.T) {
|
|||||||
})
|
})
|
||||||
node6 := test.BuildTestNode("n6", 200, 200, 10, nil)
|
node6 := test.BuildTestNode("n6", 200, 200, 10, nil)
|
||||||
|
|
||||||
p1 := test.BuildTestPod("p1", 100, 0, node1.Name, nil)
|
// Three Pods in the "dev" Namespace, bound to same ReplicaSet. 2 should be evicted.
|
||||||
p1.Namespace = "dev"
|
ownerRef1 := test.GetReplicaSetOwnerRefList()
|
||||||
|
p1 := test.BuildTestPod("p1", 100, 0, node1.Name, func(pod *v1.Pod) {
|
||||||
|
pod.Namespace = "dev"
|
||||||
|
pod.ObjectMeta.OwnerReferences = ownerRef1
|
||||||
|
})
|
||||||
p2 := test.BuildTestPod("p2", 100, 0, node1.Name, nil)
|
p2 := test.BuildTestPod("p2", 100, 0, node1.Name, nil)
|
||||||
p2.Namespace = "dev"
|
p2.Namespace = "dev"
|
||||||
p3 := test.BuildTestPod("p3", 100, 0, node1.Name, nil)
|
p3 := test.BuildTestPod("p3", 100, 0, node1.Name, nil)
|
||||||
@@ -112,8 +116,6 @@ func TestFindDuplicatePods(t *testing.T) {
|
|||||||
// ### Evictable Pods ###
|
// ### Evictable Pods ###
|
||||||
|
|
||||||
// Three Pods in the "default" Namespace, bound to same ReplicaSet. 2 should be evicted.
|
// Three Pods in the "default" Namespace, bound to same ReplicaSet. 2 should be evicted.
|
||||||
ownerRef1 := test.GetReplicaSetOwnerRefList()
|
|
||||||
p1.ObjectMeta.OwnerReferences = ownerRef1
|
|
||||||
p2.ObjectMeta.OwnerReferences = ownerRef1
|
p2.ObjectMeta.OwnerReferences = ownerRef1
|
||||||
p3.ObjectMeta.OwnerReferences = ownerRef1
|
p3.ObjectMeta.OwnerReferences = ownerRef1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user