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

refactor(TestFindDuplicatePods): inline node6 creation

This commit is contained in:
Jan Chaloupka
2025-12-14 16:10:49 +01:00
parent 6e62af3dbf
commit 044f75dcec

View File

@@ -79,7 +79,6 @@ func buildTestPodWithRSOwnerRefWithNamespaceForNode1(name, namespace string, app
func TestFindDuplicatePods(t *testing.T) { func TestFindDuplicatePods(t *testing.T) {
// first setup pods // first setup pods
node6 := test.BuildTestNode(nodeName6, 200, 200, 10, nil)
// Three Pods in the "dev" Namespace, bound to same ReplicaSet. 2 should be evicted. // Three Pods in the "dev" Namespace, bound to same ReplicaSet. 2 should be evicted.
// A DaemonSet. // A DaemonSet.
@@ -366,13 +365,13 @@ func TestFindDuplicatePods(t *testing.T) {
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p1", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p1", "dev", nil),
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p2", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p2", "dev", nil),
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p3", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p3", "dev", nil),
test.BuildTestPod("CPU-eater", 150, 150, node6.Name, func(pod *v1.Pod) { test.BuildTestPod("CPU-eater", 150, 150, nodeName6, func(pod *v1.Pod) {
pod.Namespace = "test" pod.Namespace = "test"
}), }),
}, },
nodes: []*v1.Node{ nodes: []*v1.Node{
buildTestNode(nodeName1, nil), buildTestNode(nodeName1, nil),
node6, test.BuildTestNode(nodeName6, 200, 200, 10, nil),
}, },
expectedEvictedPodCount: 0, expectedEvictedPodCount: 0,
nodefit: true, nodefit: true,
@@ -383,13 +382,13 @@ func TestFindDuplicatePods(t *testing.T) {
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p1", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p1", "dev", nil),
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p2", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p2", "dev", nil),
buildTestPodWithRSOwnerRefWithNamespaceForNode1("p3", "dev", nil), buildTestPodWithRSOwnerRefWithNamespaceForNode1("p3", "dev", nil),
test.BuildTestPod("CPU-saver", 100, 150, node6.Name, func(pod *v1.Pod) { test.BuildTestPod("CPU-saver", 100, 150, nodeName6, func(pod *v1.Pod) {
pod.Namespace = "test" pod.Namespace = "test"
}), }),
}, },
nodes: []*v1.Node{ nodes: []*v1.Node{
buildTestNode(nodeName1, nil), buildTestNode(nodeName1, nil),
node6, test.BuildTestNode(nodeName6, 200, 200, 10, nil),
}, },
expectedEvictedPodCount: 1, expectedEvictedPodCount: 1,
nodefit: true, nodefit: true,