mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
refactor(TestRemovePodsHavingTooManyRestarts): replace test.BuildTestNode with buildTestNode helpers
This commit is contained in:
@@ -35,10 +35,15 @@ import (
|
||||
|
||||
const (
|
||||
nodeName1 = "node1"
|
||||
nodeName2 = "node2"
|
||||
nodeName4 = "node4"
|
||||
nodeName5 = "node5"
|
||||
)
|
||||
|
||||
func buildTestNode(nodeName string, apply func(*v1.Node)) *v1.Node {
|
||||
return test.BuildTestNode(nodeName, 2000, 3000, 10, apply)
|
||||
}
|
||||
|
||||
func setPodContainerStatusRestartCount(pod *v1.Pod, base int32) {
|
||||
pod.Status = v1.PodStatus{
|
||||
InitContainerStatuses: []v1.ContainerStatus{
|
||||
@@ -124,8 +129,8 @@ func initPods(apply func(pod *v1.Pod)) []*v1.Pod {
|
||||
}
|
||||
|
||||
func TestRemovePodsHavingTooManyRestarts(t *testing.T) {
|
||||
node1 := test.BuildTestNode(nodeName1, 2000, 3000, 10, nil)
|
||||
node2 := test.BuildTestNode("node2", 2000, 3000, 10, func(node *v1.Node) {
|
||||
node1 := buildTestNode(nodeName1, nil)
|
||||
node2 := buildTestNode(nodeName2, func(node *v1.Node) {
|
||||
node.Spec.Taints = []v1.Taint{
|
||||
{
|
||||
Key: "hardware",
|
||||
@@ -134,13 +139,13 @@ func TestRemovePodsHavingTooManyRestarts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
})
|
||||
node3 := test.BuildTestNode("node3", 2000, 3000, 10, func(node *v1.Node) {
|
||||
node3 := buildTestNode("node3", func(node *v1.Node) {
|
||||
node.Spec = v1.NodeSpec{
|
||||
Unschedulable: true,
|
||||
}
|
||||
})
|
||||
node4 := test.BuildTestNode(nodeName4, 200, 3000, 10, nil)
|
||||
node5 := test.BuildTestNode(nodeName5, 2000, 3000, 10, nil)
|
||||
node5 := buildTestNode(nodeName5, nil)
|
||||
|
||||
createRemovePodsHavingTooManyRestartsAgrs := func(
|
||||
podRestartThresholds int32,
|
||||
|
||||
Reference in New Issue
Block a user