@@ -176,11 +176,9 @@ func TestCreatePlanActiveFailoverScale(t *testing.T) {
176176 }
177177 newPlan , changed = createPlan (log , depl , nil , spec , status , nil , c )
178178 assert .True (t , changed )
179- require .Len (t , newPlan , 2 ) // Note: Downscaling is only down 1 at a time
180- assert .Equal (t , api .ActionTypeShutdownMember , newPlan [0 ].Type )
181- assert .Equal (t , api .ActionTypeRemoveMember , newPlan [1 ].Type )
179+ require .Len (t , newPlan , 1 ) // Note: Downscaling is only down 1 at a time
180+ assert .Equal (t , api .ActionTypeRemoveMember , newPlan [0 ].Type )
182181 assert .Equal (t , api .ServerGroupSingle , newPlan [0 ].Group )
183- assert .Equal (t , api .ServerGroupSingle , newPlan [1 ].Group )
184182}
185183
186184// TestCreatePlanClusterScale creates a `cluster` deployment to test the creating of scaling plan.
@@ -263,6 +261,12 @@ func TestCreatePlanClusterScale(t *testing.T) {
263261 api.MemberStatus {
264262 ID : "cr1" ,
265263 PodName : "coordinator1" ,
264+ Conditions : api.ConditionList {
265+ api.Condition {
266+ Type : api .ConditionTypeReady ,
267+ Status : v1 .ConditionTrue ,
268+ },
269+ },
266270 },
267271 api.MemberStatus {
268272 ID : "cr2" ,
@@ -273,15 +277,14 @@ func TestCreatePlanClusterScale(t *testing.T) {
273277 spec .Coordinators .Count = util .NewInt (1 )
274278 newPlan , changed = createPlan (log , depl , nil , spec , status , nil , c )
275279 assert .True (t , changed )
276- require .Len (t , newPlan , 5 ) // Note: Downscaling is done 1 at a time
277- assert .Equal (t , api .ActionTypeCleanOutMember , newPlan [0 ].Type )
280+
281+ fmt .Printf ("%v" , newPlan )
282+
283+ require .Len (t , newPlan , 3 ) // Note: Downscaling is done 1 at a time
284+ assert .Equal (t , api .ActionTypeRemoveMember , newPlan [0 ].Type )
278285 assert .Equal (t , api .ActionTypeShutdownMember , newPlan [1 ].Type )
279286 assert .Equal (t , api .ActionTypeRemoveMember , newPlan [2 ].Type )
280- assert .Equal (t , api .ActionTypeShutdownMember , newPlan [3 ].Type )
281- assert .Equal (t , api .ActionTypeRemoveMember , newPlan [4 ].Type )
282287 assert .Equal (t , api .ServerGroupDBServers , newPlan [0 ].Group )
283- assert .Equal (t , api .ServerGroupDBServers , newPlan [1 ].Group )
284- assert .Equal (t , api .ServerGroupDBServers , newPlan [2 ].Group )
285- assert .Equal (t , api .ServerGroupCoordinators , newPlan [3 ].Group )
286- assert .Equal (t , api .ServerGroupCoordinators , newPlan [4 ].Group )
288+ assert .Equal (t , api .ServerGroupCoordinators , newPlan [1 ].Group )
289+ assert .Equal (t , api .ServerGroupCoordinators , newPlan [2 ].Group )
287290}
0 commit comments