use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class RecipeEngineTest method testUploadUpscaleRecipesWithoutRecipe.
@Test
public void testUploadUpscaleRecipesWithoutRecipe() throws CloudbreakException {
// GIVEN
HostGroup hostGroup = new HostGroup();
hostGroup.setName("worker");
// WHEN
recipeEngine.uploadUpscaleRecipes(stack(), Set.of(hostGroup), hostGroups());
// THEN
verify(orchestratorRecipeExecutor, times(0)).uploadRecipes(any(Stack.class), anyMap());
verify(recipeTemplateService, times(0)).updateAllGeneratedRecipes(anySet(), anyMap());
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterBuilderService method finalizeClusterInstall.
public void finalizeClusterInstall(Long stackId) throws CloudbreakException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
Set<HostGroup> hostGroups = hostGroupService.getByClusterWithRecipes(stack.getCluster().getId());
try {
transactionService.required(() -> {
Set<InstanceMetaData> instanceMetaDatas = loadInstanceMetadataForHostGroups(hostGroups).values().stream().flatMap(Collection::stream).collect(Collectors.toSet());
finalizeClusterInstallHandlerService.finalizeClusterInstall(instanceMetaDatas, stack.getCluster());
});
} catch (TransactionExecutionException e) {
throw new CloudbreakException(e.getCause());
}
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterUpscaleService method uploadRecipesOnNewHosts.
public void uploadRecipesOnNewHosts(Long stackId, Set<String> hostGroupNames) throws CloudbreakException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
LOGGER.debug("Start executing pre recipes");
Set<HostGroup> hostGroups = hostGroupService.getByClusterWithRecipes(stack.getCluster().getId());
Set<HostGroup> targetHostGroups = hostGroups.stream().filter(hostGroup -> hostGroupNames.contains(hostGroup.getName())).collect(Collectors.toSet());
recipeEngine.uploadUpscaleRecipes(stack, targetHostGroups, hostGroups);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterUpscaleServiceTest method testInstallServicesOnNewHostWithRestartButThereIsAnUnhealthyNode.
@Test
public void testInstallServicesOnNewHostWithRestartButThereIsAnUnhealthyNode() throws CloudbreakException {
Stack stack = new Stack();
stack.setId(1L);
Cluster cluster = new Cluster();
cluster.setId(2L);
stack.setCluster(cluster);
when(stackService.getByIdWithClusterInTransaction(eq(1L))).thenReturn(stack);
ClusterApi clusterApi = mock(ClusterApi.class);
when(clusterApiConnectors.getConnector(any(Stack.class))).thenReturn(clusterApi);
HostGroup hostGroup = new HostGroup();
InstanceGroup instanceGroup = new InstanceGroup();
InstanceMetaData im1 = new InstanceMetaData();
im1.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY);
InstanceMetaData im2 = new InstanceMetaData();
im2.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY);
InstanceMetaData im3 = new InstanceMetaData();
im3.setInstanceStatus(InstanceStatus.DELETED_BY_PROVIDER);
stack.setInstanceGroups(Set.of(instanceGroup));
instanceGroup.setInstanceMetaData(Set.of(im1, im2, im3));
hostGroup.setInstanceGroup(instanceGroup);
when(hostGroupService.getByClusterWithRecipes(any())).thenReturn(Set.of(hostGroup));
when(parcelService.removeUnusedParcelComponents(stack)).thenReturn(new ParcelOperationStatus(Collections.emptyMap(), Collections.emptyMap()));
underTest.installServicesOnNewHosts(1L, Set.of("master"), true, true);
verify(clusterApi, times(1)).upscaleCluster(any());
verify(clusterApi, times(0)).restartAll(false);
verify(parcelService).removeUnusedParcelComponents(stack);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClusterRepairFlowEventChainFactoryTest method setupHostGroup.
private HostGroup setupHostGroup(InstanceGroup instanceGroup) {
HostGroup hostGroup = mock(HostGroup.class);
when(hostGroup.getName()).thenReturn("hostGroupName");
when(hostGroup.getInstanceGroup()).thenReturn(instanceGroup);
return hostGroup;
}
Aggregations