Skip to content

Commit

Permalink
Added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sssash18 committed Jan 29, 2024
1 parent e008bb8 commit 598960a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cluster-autoscaler/cloudprovider/mcm/mcm_cloud_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,23 @@ func TestDeleteNodes(t *testing.T) {
err: nil,
},
},
{
"should not scale down a machine deployment when the corresponding machine is already in failed state",
setup{
nodes: newNodes(2, "fakeID", []bool{false, false}),
machines: newMachines(2, "fakeID", &v1alpha1.MachineStatus{CurrentStatus: v1alpha1.CurrentStatus{Phase: v1alpha1.MachineFailed}}, "machinedeployment-1", "machineset-1", []string{"3", "3"}, []bool{false, false}),
machineSets: newMachineSets(1, "machinedeployment-1"),
machineDeployments: newMachineDeployments(1, 2, nil, nil, nil),
nodeGroups: []string{nodeGroup1},
},
action{node: newNodes(1, "fakeID", []bool{false})[0]},
expect{
machines: newMachines(1, "fakeID", nil, "machinedeployment-1", "machineset-1", []string{"3"}, []bool{true}),
mdName: "machinedeployment-1",
mdReplicas: 2,
err: nil,
},
},
{
"should not scale down a machine deployment below the minimum",
setup{
Expand Down

0 comments on commit 598960a

Please sign in to comment.