use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class DecommissionHandlerTest method setUp.
@BeforeEach
public void setUp() {
stack = new Stack();
stack.setId(STACK_ID);
cluster = new Cluster();
cluster.setId(CLUSTER_ID);
stack.setCluster(cluster);
instance = new InstanceMetaData();
instance.setDiscoveryFQDN(FQDN);
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroup.setInstanceMetaData(Set.of(instance));
stack.setInstanceGroups(Set.of(instanceGroup));
hostGroup = new HostGroup();
hostGroup.setName(HOST_GROUP_NAME);
stack.setResourceCrn(CrnTestUtil.getDatahubCrnBuilder().setAccountId("a1").setResource("r1").build().toString());
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterUpscaleServiceTest method testInstallServicesWithRepairAndServiceRestartWhenOneHostIsDecommissioned.
@Test
public void testInstallServicesWithRepairAndServiceRestartWhenOneHostIsDecommissioned() throws CloudbreakException {
HostGroup hostGroup = newHostGroup("master", newInstance(InstanceStatus.SERVICES_HEALTHY), newInstance(InstanceStatus.SERVICES_HEALTHY), newInstance(InstanceStatus.SERVICES_HEALTHY));
when(hostGroupService.getByClusterWithRecipes(any())).thenReturn(Set.of(hostGroup));
when(hostGroupService.getByCluster(any())).thenReturn(Set.of(hostGroup));
when(parcelService.removeUnusedParcelComponents(stack)).thenReturn(new ParcelOperationStatus(Map.of(), Map.of()));
when(clusterApiConnectors.getConnector(any(Stack.class))).thenReturn(clusterApi);
when(clusterApi.clusterStatusService()).thenReturn(clusterStatusService);
when(clusterApi.clusterCommissionService()).thenReturn(clusterCommissionService);
when(clusterStatusService.getDecommissionedHostsFromCM()).thenReturn(List.of("master-2"));
underTest.installServicesOnNewHosts(1L, Set.of("master"), true, true, Map.of("master", Set.of("master-1", "master-2", "master-3")));
inOrder.verify(parcelService).removeUnusedParcelComponents(stack);
inOrder.verify(recipeEngine, times(1)).executePostAmbariStartRecipes(stack, Set.of(hostGroup));
inOrder.verify(clusterApi, times(1)).upscaleCluster(any());
inOrder.verify(clusterStatusService, times(1)).getDecommissionedHostsFromCM();
inOrder.verify(clusterCommissionService, times(1)).recommissionHosts(List.of("master-2"));
inOrder.verify(clusterApi, times(1)).restartAll(false);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterUpscaleServiceTest method testInstallServicesWithRepairAndServiceRestart.
@Test
public void testInstallServicesWithRepairAndServiceRestart() throws CloudbreakException {
HostGroup hostGroup = newHostGroup("master", newInstance(InstanceStatus.SERVICES_HEALTHY), newInstance(InstanceStatus.SERVICES_HEALTHY), newInstance(InstanceStatus.SERVICES_HEALTHY));
when(hostGroupService.getByClusterWithRecipes(any())).thenReturn(Set.of(hostGroup));
when(hostGroupService.getByCluster(any())).thenReturn(Set.of(hostGroup));
when(parcelService.removeUnusedParcelComponents(stack)).thenReturn(new ParcelOperationStatus(Map.of(), Map.of()));
when(clusterApiConnectors.getConnector(any(Stack.class))).thenReturn(clusterApi);
when(clusterApi.clusterStatusService()).thenReturn(clusterStatusService);
when(clusterStatusService.getDecommissionedHostsFromCM()).thenReturn(List.of());
underTest.installServicesOnNewHosts(1L, Set.of("master"), true, true, Map.of("master", Set.of("master-1", "master-2", "master-3")));
inOrder.verify(parcelService).removeUnusedParcelComponents(stack);
inOrder.verify(recipeEngine, times(1)).executePostAmbariStartRecipes(stack, Set.of(hostGroup));
inOrder.verify(clusterApi, times(1)).upscaleCluster(any());
inOrder.verify(clusterStatusService, times(1)).getDecommissionedHostsFromCM();
inOrder.verify(clusterCommissionService, times(0)).recommissionHosts(any());
inOrder.verify(clusterApi, times(1)).restartAll(false);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterRepairFlowEventChainFactoryTest method testRepairSingleGatewayMultipleNodes.
@Test
public void testRepairSingleGatewayMultipleNodes() {
Stack stack = getStack(NOT_MULTIPLE_GATEWAY);
setupStackView();
when(stackService.findClustersConnectedToDatalakeByDatalakeStackId(STACK_ID)).thenReturn(Set.of());
HostGroup masterHostGroup = setupHostGroup("hostGroup-master", setupInstanceGroup(InstanceGroupType.GATEWAY));
when(hostGroupService.findHostGroupInClusterByName(anyLong(), eq("hostGroup-master"))).thenReturn(Optional.of(masterHostGroup));
HostGroup coreHostGroup = setupHostGroup("hostGroup-core", setupInstanceGroup(InstanceGroupType.CORE));
when(hostGroupService.findHostGroupInClusterByName(anyLong(), eq("hostGroup-core"))).thenReturn(Optional.of(coreHostGroup));
setupPrimaryGateway();
FlowTriggerEventQueue eventQueues = underTest.createFlowTriggerEventQueue(new TriggerEventBuilder(stack).withFailedPrimaryGateway().withFailedCore().build());
List<String> triggeredOperations = eventQueues.getQueue().stream().map(Selectable::selector).collect(Collectors.toList());
assertEquals(List.of("FLOWCHAIN_INIT_TRIGGER_EVENT", "STACK_DOWNSCALE_TRIGGER_EVENT", "FULL_UPSCALE_TRIGGER_EVENT", "RESCHEDULE_STATUS_CHECK_TRIGGER_EVENT", "FLOWCHAIN_FINALIZE_TRIGGER_EVENT"), triggeredOperations);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClouderaHostGroupAssociationBuilderTest method createHostGroup.
private HostGroup createHostGroup(String name) {
HostGroup hostGroup = new HostGroup();
hostGroup.setName(name);
return hostGroup;
}
Aggregations