@@ -681,7 +681,7 @@ func TestCreatePlan(t *testing.T) {
681681 ExpectedLog : "Creating rotation plan" ,
682682 },
683683 {
684- Name : "Member in failed state" ,
684+ Name : "Agent in failed state" ,
685685 context : & testContext {
686686 ArangoDeployment : deploymentTemplate .DeepCopy (),
687687 },
@@ -690,10 +690,46 @@ func TestCreatePlan(t *testing.T) {
690690 Count : util .NewInt (2 ),
691691 }
692692 ad .Status .Members .Agents [0 ].Phase = api .MemberPhaseFailed
693+ ad .Status .Members .Agents [0 ].ID = "id"
693694 },
694695 ExpectedPlan : []api.Action {
695- api .NewAction (api .ActionTypeRemoveMember , api .ServerGroupAgents , "" ),
696- api .NewAction (api .ActionTypeAddMember , api .ServerGroupAgents , "" ),
696+ api .NewAction (api .ActionTypeRecreateMember , api .ServerGroupAgents , "id" ),
697+ },
698+ ExpectedLog : "Restoring old member. For agency members recreation of PVC is not supported - to prevent DataLoss" ,
699+ },
700+ {
701+ Name : "Coordinator in failed state" ,
702+ context : & testContext {
703+ ArangoDeployment : deploymentTemplate .DeepCopy (),
704+ },
705+ Helper : func (ad * api.ArangoDeployment ) {
706+ ad .Spec .Coordinators = api.ServerGroupSpec {
707+ Count : util .NewInt (2 ),
708+ }
709+ ad .Status .Members .Coordinators [0 ].Phase = api .MemberPhaseFailed
710+ ad .Status .Members .Coordinators [0 ].ID = "id"
711+ },
712+ ExpectedPlan : []api.Action {
713+ api .NewAction (api .ActionTypeRemoveMember , api .ServerGroupCoordinators , "id" ),
714+ api .NewAction (api .ActionTypeAddMember , api .ServerGroupCoordinators , "" ),
715+ },
716+ ExpectedLog : "Creating member replacement plan because member has failed" ,
717+ },
718+ {
719+ Name : "DBServer in failed state" ,
720+ context : & testContext {
721+ ArangoDeployment : deploymentTemplate .DeepCopy (),
722+ },
723+ Helper : func (ad * api.ArangoDeployment ) {
724+ ad .Spec .DBServers = api.ServerGroupSpec {
725+ Count : util .NewInt (2 ),
726+ }
727+ ad .Status .Members .DBServers [0 ].Phase = api .MemberPhaseFailed
728+ ad .Status .Members .DBServers [0 ].ID = "id"
729+ },
730+ ExpectedPlan : []api.Action {
731+ api .NewAction (api .ActionTypeRemoveMember , api .ServerGroupDBServers , "id" ),
732+ api .NewAction (api .ActionTypeAddMember , api .ServerGroupDBServers , "" ),
697733 },
698734 ExpectedLog : "Creating member replacement plan because member has failed" ,
699735 },
0 commit comments