Search in sources :

Example 66 with InstanceGroup

use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.

the class MeteringAzureMetadataPatchServiceTest method createStack.

private Stack createStack() {
    Stack stack = new Stack();
    stack.setId(1L);
    stack.setType(StackType.WORKLOAD);
    stack.setCloudPlatform(CloudPlatform.AZURE.name());
    stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
    Cluster cluster = new Cluster();
    cluster.setId(1L);
    Workspace workspace = new Workspace();
    workspace.setId(1L);
    stack.setWorkspace(workspace);
    stack.setCluster(cluster);
    InstanceGroup instanceGroup = createInstanceGroup();
    instanceGroup.setInstanceMetaData(Set.of(createInstanceMetaData()));
    stack.setInstanceGroups(Set.of(instanceGroup));
    return stack;
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)

Example 67 with InstanceGroup

use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.

the class UnboundRestartPatchServiceTest method setCmServerReachability.

private void setCmServerReachability(boolean reachable) {
    InstanceGroup instanceGroup = new InstanceGroup();
    InstanceMetaData instanceMetaData = new InstanceMetaData();
    instanceMetaData.setClusterManagerServer(true);
    instanceMetaData.setInstanceStatus(reachable ? InstanceStatus.SERVICES_RUNNING : InstanceStatus.ORCHESTRATION_FAILED);
    instanceGroup.setInstanceMetaData(Set.of(instanceMetaData));
    stack.setInstanceGroups(Set.of(instanceGroup));
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)

Example 68 with InstanceGroup

use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.

the class GatewaySecurityGroupDecoratorTest method testConvertDoesntExtendGatewaySecurityGroupsWithDefaultGatewayCidrsIfItsEmptyWithoutCCM.

@Test
public void testConvertDoesntExtendGatewaySecurityGroupsWithDefaultGatewayCidrsIfItsEmptyWithoutCCM() {
    ReflectionTestUtils.setField(underTest, "defaultGatewayCidr", Set.of());
    // WHEN
    underTest.extendGatewaySecurityGroupWithDefaultGatewayCidrs(stack, Tunnel.DIRECT);
    // THEN
    Set<InstanceGroup> gateways = stack.getInstanceGroups().stream().filter(ig -> InstanceGroupType.isGateway(ig.getInstanceGroupType())).collect(Collectors.toSet());
    for (InstanceGroup ig : gateways) {
        assertNull(ig.getSecurityGroup());
    }
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Arrays(java.util.Arrays) Assert.assertNull(org.junit.Assert.assertNull) Set(java.util.Set) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) Test(org.junit.Test) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Collectors(java.util.stream.Collectors) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) Tunnel(com.sequenceiq.common.api.type.Tunnel) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Test(org.junit.Test)

Example 69 with InstanceGroup

use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.

the class GatewaySecurityGroupDecoratorTest method testConvertDoesntExtendsGatewaySecurityGroupsWithDefaultGatewayCidrsWithCCM.

@Test
public void testConvertDoesntExtendsGatewaySecurityGroupsWithDefaultGatewayCidrsWithCCM() {
    ReflectionTestUtils.setField(underTest, "defaultGatewayCidr", Set.of("0.0.0.0/0", "1.1.1.1/1"));
    ReflectionTestUtils.setField(underTest, "nginxPort", 9443);
    // WHEN
    underTest.extendGatewaySecurityGroupWithDefaultGatewayCidrs(stack, Tunnel.CCM);
    // THEN
    Set<InstanceGroup> gateways = stack.getInstanceGroups().stream().filter(ig -> InstanceGroupType.isGateway(ig.getInstanceGroupType())).collect(Collectors.toSet());
    for (InstanceGroup ig : gateways) {
        assertNull(ig.getSecurityGroup());
    }
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Arrays(java.util.Arrays) Assert.assertNull(org.junit.Assert.assertNull) Set(java.util.Set) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) Test(org.junit.Test) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Collectors(java.util.stream.Collectors) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) Tunnel(com.sequenceiq.common.api.type.Tunnel) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Test(org.junit.Test)

Example 70 with InstanceGroup

use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.

the class GatewaySecurityGroupDecoratorTest method testConvertDoesntExtendGatewaySecurityGroupsWithDefaultGatewayCidrsIfItsEmptyWithCCM.

@Test
public void testConvertDoesntExtendGatewaySecurityGroupsWithDefaultGatewayCidrsIfItsEmptyWithCCM() {
    ReflectionTestUtils.setField(underTest, "defaultGatewayCidr", Set.of());
    // WHEN
    underTest.extendGatewaySecurityGroupWithDefaultGatewayCidrs(stack, Tunnel.CCM);
    // THEN
    Set<InstanceGroup> gateways = stack.getInstanceGroups().stream().filter(ig -> InstanceGroupType.isGateway(ig.getInstanceGroupType())).collect(Collectors.toSet());
    for (InstanceGroup ig : gateways) {
        assertNull(ig.getSecurityGroup());
    }
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Arrays(java.util.Arrays) Assert.assertNull(org.junit.Assert.assertNull) Set(java.util.Set) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) Test(org.junit.Test) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Collectors(java.util.stream.Collectors) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) Tunnel(com.sequenceiq.common.api.type.Tunnel) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Test(org.junit.Test)

Aggregations

InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)288 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)132 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)93 Test (org.junit.jupiter.api.Test)91 HashSet (java.util.HashSet)68 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)57 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)47 Template (com.sequenceiq.cloudbreak.domain.Template)45 Test (org.junit.Test)44 Json (com.sequenceiq.cloudbreak.common.json.Json)38 Set (java.util.Set)37 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)34 ArrayList (java.util.ArrayList)31 LinkedHashSet (java.util.LinkedHashSet)31 Map (java.util.Map)28 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)27 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)27 List (java.util.List)26 HostGroup (com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup)25 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)22