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;
}
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));
}
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());
}
}
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());
}
}
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());
}
}
Aggregations