Search in sources :

Example 21 with Node

use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.

the class OrchestratorRecipeExecutorTest method postClusterManagerStartRecipesShouldUseReachableNodes.

@Test
public void postClusterManagerStartRecipesShouldUseReachableNodes() throws CloudbreakException, CloudbreakOrchestratorFailedException, CloudbreakOrchestratorTimeoutException {
    when(stack.getId()).thenReturn(1L);
    Cluster cluster = new Cluster();
    cluster.setId(2L);
    when(stack.getCluster()).thenReturn(cluster);
    when(gatewayConfigService.getPrimaryGatewayConfig(any())).thenReturn(gatewayConfig);
    Set<Node> nodes = Set.of(this.node);
    when(stackUtil.collectReachableNodes(any())).thenReturn(nodes);
    underTest.postClusterManagerStartRecipes(stack);
    verify(gatewayConfigService).getPrimaryGatewayConfig(stack);
    verify(stackUtil).collectReachableNodes(stack);
    verify(hostOrchestrator).postClusterManagerStartRecipes(eq(gatewayConfig), eq(nodes), any());
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Test(org.junit.Test)

Example 22 with Node

use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.

the class OrchestratorRecipeExecutorTest method postClusterInstallShouldUseReachableNodes.

@Test
public void postClusterInstallShouldUseReachableNodes() throws CloudbreakException, CloudbreakOrchestratorFailedException, CloudbreakOrchestratorTimeoutException {
    when(stack.getId()).thenReturn(1L);
    Cluster cluster = new Cluster();
    cluster.setId(2L);
    when(stack.getCluster()).thenReturn(cluster);
    when(gatewayConfigService.getPrimaryGatewayConfig(any())).thenReturn(gatewayConfig);
    Set<Node> nodes = Set.of(this.node);
    when(stackUtil.collectReachableNodes(any())).thenReturn(nodes);
    underTest.postClusterInstall(stack);
    verify(gatewayConfigService).getPrimaryGatewayConfig(stack);
    verify(stackUtil).collectReachableNodes(stack);
    verify(hostOrchestrator).postInstallRecipes(eq(gatewayConfig), eq(nodes), any());
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Test(org.junit.Test)

Example 23 with Node

use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.

the class OrchestratorRecipeExecutorTest method testPreTerminationRecipes.

@Test
public void testPreTerminationRecipes() throws CloudbreakException, CloudbreakOrchestratorFailedException, CloudbreakOrchestratorTimeoutException {
    when(gatewayConfigService.getPrimaryGatewayConfig(any())).thenReturn(gatewayConfig);
    Set<Node> nodes = Set.of(node);
    when(stackUtil.collectReachableNodes(any())).thenReturn(nodes);
    underTest.preTerminationRecipes(stack, false);
    verify(hostOrchestrator).preTerminationRecipes(eq(gatewayConfig), eq(Set.of(node)), exitCriteriaModelCaptor.capture(), eq(false));
    ExitCriteriaModel exitCriteriaModel = exitCriteriaModelCaptor.getValue();
    assertThat(exitCriteriaModel).isOfAnyClassIn(ClusterDeletionBasedExitCriteriaModel.class);
}
Also used : ExitCriteriaModel(com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel) ClusterDeletionBasedExitCriteriaModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Test(org.junit.Test)

Example 24 with Node

use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.

the class FreeIpaNodeUtilServiceTest method testMapInstancesToNodesConvertsInstanceWithPrivateIp.

@Test
public void testMapInstancesToNodesConvertsInstanceWithPrivateIp() {
    Set<Node> nodes = underTest.mapInstancesToNodes(Set.of(im));
    assertEquals(1, nodes.size());
    Node node = nodes.iterator().next();
    assertEquals(PRIVATE_IP, node.getPrivateIp());
    assertEquals(PRIVATE_IP, node.getPublicIp());
    assertEquals(INSTANCE_ID, node.getInstanceId());
    assertEquals(INSTANCE_TYPE, node.getInstanceType());
    assertEquals(FQDN, node.getHostname());
    assertEquals(GROUP_NAME, node.getHostGroup());
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Test(org.junit.jupiter.api.Test)

Example 25 with Node

use of com.sequenceiq.cloudbreak.common.orchestration.Node in project cloudbreak by hortonworks.

the class FreeIpaNodeUtilServiceTest method testMapInstancesToNodesConvertsInstanceWithPublicIp.

@Test
public void testMapInstancesToNodesConvertsInstanceWithPublicIp() {
    im.setPublicIp(PUBLIC_IP);
    Set<Node> nodes = underTest.mapInstancesToNodes(Set.of(im));
    assertEquals(1, nodes.size());
    Node node = nodes.iterator().next();
    assertEquals(PRIVATE_IP, node.getPrivateIp());
    assertEquals(PUBLIC_IP, node.getPublicIp());
    assertEquals(INSTANCE_ID, node.getInstanceId());
    assertEquals(INSTANCE_TYPE, node.getInstanceType());
    assertEquals(FQDN, node.getHostname());
    assertEquals(GROUP_NAME, node.getHostGroup());
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Test(org.junit.jupiter.api.Test)

Aggregations

Node (com.sequenceiq.cloudbreak.common.orchestration.Node)126 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)57 HashSet (java.util.HashSet)42 Map (java.util.Map)32 JsonNode (com.fasterxml.jackson.databind.JsonNode)30 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)29 Test (org.junit.Test)29 HashMap (java.util.HashMap)28 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)27 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)26 ArrayList (java.util.ArrayList)26 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)25 ExitCriteriaModel (com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel)25 Set (java.util.Set)25 Test (org.junit.jupiter.api.Test)25 List (java.util.List)22 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)21 IOException (java.io.IOException)21 Collectors (java.util.stream.Collectors)21 BootstrapParams (com.sequenceiq.cloudbreak.orchestrator.model.BootstrapParams)19