@Test public void shouldNotUpdateStackStateWhenThereAreNoNodesToRepair() { HostGroup hostGroup1 = new HostGroup(); hostGroup1.setName("hostGroup1"); hostGroup1.setRecoveryMode(RecoveryMode.MANUAL); InstanceMetaData host1 = getHost("host1", hostGroup1.getName(), InstanceStatus.SERVICES_HEALTHY, InstanceGroupType.CORE); hostGroup1.setInstanceGroup(host1.getInstanceGroup()); when(hostGroupService.getByCluster(eq(1L))).thenReturn(Set.of(hostGroup1)); when(stackService.getByIdWithListsInTransaction(1L)).thenReturn(stack); when(stack.getInstanceMetaDataAsList()).thenReturn(List.of(host1)); BadRequestException exception = assertThrows(BadRequestException.class, () -> { underTest.repairHostGroups(1L, Set.of("hostGroup1"), false, false); }); assertEquals("Could not trigger cluster repair for stack 1 because node list is incorrect", exception.getMessage()); verifyEventArguments(CLUSTER_MANUALRECOVERY_NO_NODES_TO_RECOVER, "hostGroup1"); verifyNoInteractions(stackUpdater); }
public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); } }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }  }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }  FlowIdentifier repairAll(Long stackId); FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices); FlowIdentifier repairNodes(Long stackId, Set<String> nodeIds, boolean deleteVolumes, boolean removeOnly, boolean restartServices); Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairWithDryRun(Long stackId); }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }  FlowIdentifier repairAll(Long stackId); FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices); FlowIdentifier repairNodes(Long stackId, Set<String> nodeIds, boolean deleteVolumes, boolean removeOnly, boolean restartServices); Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairWithDryRun(Long stackId);  }