Skip to content

Commit 783faa3

Browse files
author
lamai93
committed
Fixed unittest.
1 parent 90abf5d commit 783faa3

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

pkg/deployment/reconcile/plan_builder_test.go

+12-15
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ 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, 1) // Note: Downscaling is only down 1 at a time
180-
assert.Equal(t, api.ActionTypeRemoveMember, newPlan[0].Type)
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)
181182
assert.Equal(t, api.ServerGroupSingle, newPlan[0].Group)
183+
assert.Equal(t, api.ServerGroupSingle, newPlan[1].Group)
182184
}
183185

184186
// TestCreatePlanClusterScale creates a `cluster` deployment to test the creating of scaling plan.
@@ -261,12 +263,6 @@ func TestCreatePlanClusterScale(t *testing.T) {
261263
api.MemberStatus{
262264
ID: "cr1",
263265
PodName: "coordinator1",
264-
Conditions: api.ConditionList{
265-
api.Condition{
266-
Type: api.ConditionTypeReady,
267-
Status: v1.ConditionTrue,
268-
},
269-
},
270266
},
271267
api.MemberStatus{
272268
ID: "cr2",
@@ -277,14 +273,15 @@ func TestCreatePlanClusterScale(t *testing.T) {
277273
spec.Coordinators.Count = util.NewInt(1)
278274
newPlan, changed = createPlan(log, depl, nil, spec, status, nil, c)
279275
assert.True(t, changed)
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)
276+
require.Len(t, newPlan, 5) // Note: Downscaling is done 1 at a time
277+
assert.Equal(t, api.ActionTypeCleanOutMember, newPlan[0].Type)
285278
assert.Equal(t, api.ActionTypeShutdownMember, newPlan[1].Type)
286279
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)
287282
assert.Equal(t, api.ServerGroupDBServers, newPlan[0].Group)
288-
assert.Equal(t, api.ServerGroupCoordinators, newPlan[1].Group)
289-
assert.Equal(t, api.ServerGroupCoordinators, newPlan[2].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)
290287
}

0 commit comments

Comments
 (0)