@@ -1058,13 +1058,13 @@ func TestCreatePlan(t *testing.T) {
10581058 ExpectedLog : "Creating member replacement plan because member has failed" ,
10591059 },
10601060 {
1061- Name : "DBServer in failed state" ,
1061+ Name : "DBServer in failed state - recreate " ,
10621062 context : & testContext {
10631063 ArangoDeployment : deploymentTemplate .DeepCopy (),
10641064 },
10651065 Helper : func (ad * api.ArangoDeployment ) {
10661066 ad .Spec .DBServers = api.ServerGroupSpec {
1067- Count : util .NewInt (2 ),
1067+ Count : util .NewInt (3 ),
10681068 }
10691069 ad .Status .Members .DBServers [0 ].Phase = api .MemberPhaseFailed
10701070 ad .Status .Members .DBServers [0 ].ID = "id"
@@ -1076,6 +1076,26 @@ func TestCreatePlan(t *testing.T) {
10761076 },
10771077 ExpectedLog : "Creating member replacement plan because member has failed" ,
10781078 },
1079+ {
1080+ Name : "DBServer in failed state - remove" ,
1081+ context : & testContext {
1082+ ArangoDeployment : deploymentTemplate .DeepCopy (),
1083+ },
1084+ Helper : func (ad * api.ArangoDeployment ) {
1085+ ad .Spec .DBServers = api.ServerGroupSpec {
1086+ Count : util .NewInt (2 ),
1087+ }
1088+ ad .Status .Members .DBServers [2 ].Phase = api .MemberPhaseFailed
1089+ ad .Status .Members .DBServers [2 ].ID = "id3"
1090+ },
1091+ ExpectedPlan : []api.Action {
1092+ actions .NewAction (api .ActionTypeCleanOutMember , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1093+ actions .NewAction (api .ActionTypeKillMemberPod , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1094+ actions .NewAction (api .ActionTypeShutdownMember , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1095+ actions .NewAction (api .ActionTypeRemoveMember , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1096+ },
1097+ ExpectedLog : "Creating scale-down plan" ,
1098+ },
10791099 {
10801100 Name : "CleanOut DBserver" ,
10811101 context : & testContext {
@@ -1101,6 +1121,32 @@ func TestCreatePlan(t *testing.T) {
11011121 },
11021122 ExpectedLog : "Creating dbserver replacement plan because server is cleanout in created phase" ,
11031123 },
1124+ {
1125+ Name : "CleanOut DBserver - scale down" ,
1126+ context : & testContext {
1127+ ArangoDeployment : deploymentTemplate .DeepCopy (),
1128+ },
1129+ Helper : func (ad * api.ArangoDeployment ) {
1130+ ad .Spec .DBServers = api.ServerGroupSpec {
1131+ Count : util .NewInt (2 ),
1132+ }
1133+ ad .Status .Members .DBServers [2 ].ID = "id3"
1134+ ad .Status .Members .DBServers [2 ].Phase = api .MemberPhaseCreated
1135+ ad .Status .Members .DBServers [2 ].Conditions = api.ConditionList {
1136+ {
1137+ Type : api .ConditionTypeCleanedOut ,
1138+ Status : core .ConditionTrue ,
1139+ },
1140+ }
1141+ },
1142+ ExpectedPlan : []api.Action {
1143+ actions .NewAction (api .ActionTypeCleanOutMember , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1144+ actions .NewAction (api .ActionTypeKillMemberPod , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1145+ actions .NewAction (api .ActionTypeShutdownMember , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1146+ actions .NewAction (api .ActionTypeRemoveMember , api .ServerGroupDBServers , withPredefinedMember ("id3" )),
1147+ },
1148+ ExpectedLog : "Creating scale-down plan" ,
1149+ },
11041150 {
11051151 Name : "Scale down DBservers" ,
11061152 context : & testContext {
0 commit comments