Search in sources :

Example 66 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class StackStatusIntegrationTest method setUpStack.

private void setUpStack() {
    underTest.setLocalId(STACK_ID.toString());
    stack = new Stack();
    stack.setId(STACK_ID);
    Cluster cluster = new Cluster();
    cluster.setVariant("AWS");
    cluster.setClusterManagerIp("192.168.0.1");
    cluster.setId(2L);
    stack.setCluster(cluster);
    stack.setResourceCrn("crn:stack");
    User creator = new User();
    creator.setUserId("user-id");
    stack.setCreator(creator);
    Workspace workspace = new Workspace();
    workspace.setId(564L);
    stack.setWorkspace(workspace);
    when(stackService.get(STACK_ID)).thenReturn(stack);
    when(instanceMetaDataService.findNotTerminatedAndNotZombieForStack(STACK_ID)).thenReturn(runningInstances);
    when(instanceMetaDataService.findNotTerminatedAndNotZombieForStackWithoutInstanceGroups(STACK_ID)).thenReturn(runningInstances);
}
Also used : User(com.sequenceiq.cloudbreak.workspace.model.User) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 67 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class ClusterManagerUpgradeServiceTest method testUpgradeClusterManagerWithoutStartServices.

@Test
public void testUpgradeClusterManagerWithoutStartServices() throws CloudbreakOrchestratorException, CloudbreakException {
    Cluster cluster = stack.getCluster();
    underTest.upgradeClusterManager(STACK_ID, false);
    verify(gatewayConfigService, times(1)).getGatewayConfig(stack, stack.getPrimaryGatewayInstance(), cluster.getGateway() != null);
    verify(clusterComponentConfigProvider, times(1)).getClouderaManagerRepoDetails(cluster.getId());
    verify(hostOrchestrator, times(1)).upgradeClusterManager(any(), any(), any(), any(), any());
    verify(clusterApi).stopCluster(true);
    verify(clusterHostServiceRunner, times(1)).decoratePillarWithClouderaManagerRepo(any(), any(), any());
    verify(clusterHostServiceRunner, times(1)).createPillarWithClouderaManagerSettings(any(), any(), any());
    verify(clusterApi, never()).startCluster();
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Test(org.junit.Test)

Example 68 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class ClusterManagerUpgradeServiceTest method testUpgradeClusterManagerShouldNotAddCsdToPillarWhenTheClusterTypeIsDataLake.

@Test
public void testUpgradeClusterManagerShouldNotAddCsdToPillarWhenTheClusterTypeIsDataLake() throws CloudbreakOrchestratorException, CloudbreakException {
    Cluster cluster = stack.getCluster();
    stack.setType(StackType.DATALAKE);
    underTest.upgradeClusterManager(STACK_ID, true);
    verify(gatewayConfigService, times(1)).getGatewayConfig(stack, stack.getPrimaryGatewayInstance(), cluster.getGateway() != null);
    verify(clusterComponentConfigProvider, times(1)).getClouderaManagerRepoDetails(cluster.getId());
    verify(hostOrchestrator, times(1)).upgradeClusterManager(any(), any(), any(), any(), any());
    verify(clusterApi).stopCluster(true);
    verify(clusterHostServiceRunner, times(1)).decoratePillarWithClouderaManagerRepo(any(), any(), any());
    verify(clusterHostServiceRunner, times(1)).createPillarWithClouderaManagerSettings(any(), any(), any());
    verify(clusterApi).startCluster();
    verify(csdParcelDecorator, times(1)).decoratePillarWithCsdParcels(any(), any());
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Test(org.junit.Test)

Example 69 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class ClusterManagerUpgradeServiceTest method setUp.

@Before
public void setUp() {
    stack = TestUtil.stack(Status.AVAILABLE, TestUtil.awsCredential());
    Cluster cluster = TestUtil.cluster();
    stack.setCluster(cluster);
    when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
    when(clusterApiConnectors.getConnector(stack)).thenReturn(clusterApi);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Before(org.junit.Before)

Example 70 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class ClusterManagerUpgradeServiceTest method testUpgradeClusterManagerShouldAddCsdToPillarWhenTheClusterTypeIsWorkload.

@Test
public void testUpgradeClusterManagerShouldAddCsdToPillarWhenTheClusterTypeIsWorkload() throws CloudbreakOrchestratorException, CloudbreakException {
    Cluster cluster = stack.getCluster();
    stack.setType(StackType.WORKLOAD);
    underTest.upgradeClusterManager(STACK_ID, true);
    verify(gatewayConfigService, times(1)).getGatewayConfig(stack, stack.getPrimaryGatewayInstance(), cluster.getGateway() != null);
    verify(clusterComponentConfigProvider, times(1)).getClouderaManagerRepoDetails(cluster.getId());
    verify(hostOrchestrator, times(1)).upgradeClusterManager(any(), any(), any(), any(), any());
    verify(clusterApi).stopCluster(true);
    verify(clusterHostServiceRunner, times(1)).decoratePillarWithClouderaManagerRepo(any(), any(), any());
    verify(clusterHostServiceRunner, times(1)).createPillarWithClouderaManagerSettings(any(), any(), any());
    verify(clusterApi).startCluster();
    verify(csdParcelDecorator, times(1)).decoratePillarWithCsdParcels(any(), any());
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Test(org.junit.Test)

Aggregations

Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)407 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)248 Test (org.junit.jupiter.api.Test)125 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)63 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)60 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)58 Optional (java.util.Optional)51 Test (org.junit.Test)50 List (java.util.List)49 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)47 Set (java.util.Set)43 Json (com.sequenceiq.cloudbreak.common.json.Json)39 Map (java.util.Map)39 Collectors (java.util.stream.Collectors)39 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)37 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)36 Inject (javax.inject.Inject)36 Logger (org.slf4j.Logger)36 LoggerFactory (org.slf4j.LoggerFactory)36 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)35