use of com.sequenceiq.common.api.type.LoadBalancerType in project cloudbreak by hortonworks.
the class AwsLoadBalancerCommonServiceTest method testSelectLoadBalancerSubnetIdsWhenSubnetsArePrivateAndInstanceGroupNetworkContainsSubnetForMultiAz.
@Test
public void testSelectLoadBalancerSubnetIdsWhenSubnetsArePrivateAndInstanceGroupNetworkContainsSubnetForMultiAz() {
AwsNetworkView awsNetworkView = createNetworkView(PRIVATE_ID_1, null);
LoadBalancerType loadBalancerType = LoadBalancerType.PRIVATE;
CloudLoadBalancer cloudLoadBalancer = createCloudLoadBalancer(loadBalancerType, List.of(SUBNET_ID_1, SUBNET_ID_2));
Set<String> subnetIds = underTest.selectLoadBalancerSubnetIds(loadBalancerType, awsNetworkView, cloudLoadBalancer);
assertEquals(Set.of(SUBNET_ID_1, SUBNET_ID_2), subnetIds);
}
use of com.sequenceiq.common.api.type.LoadBalancerType in project cloudbreak by hortonworks.
the class AwsLoadBalancerCommonServiceTest method testSelectLoadBalancerSubnetIdsPublicNoEndpointGateway.
@Test
public void testSelectLoadBalancerSubnetIdsPublicNoEndpointGateway() {
AwsNetworkView awsNetworkView = createNetworkView(PUBLIC_ID_1, null);
LoadBalancerType loadBalancerType = LoadBalancerType.PUBLIC;
CloudLoadBalancer cloudLoadBalancer = createCloudLoadBalancer(loadBalancerType);
Set<String> subnetIds = underTest.selectLoadBalancerSubnetIds(loadBalancerType, awsNetworkView, cloudLoadBalancer);
assertEquals(Set.of(PUBLIC_ID_1), subnetIds);
}
use of com.sequenceiq.common.api.type.LoadBalancerType in project cloudbreak by hortonworks.
the class AwsLoadBalancerCommonServiceTest method testSelectLoadBalancerSubnetIdsWhenEndpointGatewaySetAndInstanceGroupNetworkContainsSubnetForMultiAz.
@Test
public void testSelectLoadBalancerSubnetIdsWhenEndpointGatewaySetAndInstanceGroupNetworkContainsSubnetForMultiAz() {
AwsNetworkView awsNetworkView = createNetworkView(null, PUBLIC_ID_1);
LoadBalancerType loadBalancerType = LoadBalancerType.PUBLIC;
CloudLoadBalancer cloudLoadBalancer = createCloudLoadBalancerWithEndpointGateay(loadBalancerType, List.of(SUBNET_ID_1, SUBNET_ID_2), List.of(PUBLIC_SUBNET_ID_1, PUBLIC_SUBNET_ID_2));
Set<String> subnetIds = underTest.selectLoadBalancerSubnetIds(loadBalancerType, awsNetworkView, cloudLoadBalancer);
assertEquals(Set.of(PUBLIC_ID_1, PUBLIC_SUBNET_ID_1, PUBLIC_SUBNET_ID_2), subnetIds);
}
use of com.sequenceiq.common.api.type.LoadBalancerType in project cloudbreak by hortonworks.
the class AwsLaunchServiceLoadBalancerTest method testUpdateCloudformationWithLoadBalancerMissingTargetGroup.
@Test
public void testUpdateCloudformationWithLoadBalancerMissingTargetGroup() {
List<CloudResource> instances = createInstances();
AwsNetworkView awsNetworkView = createNetworkView(PRIVATE_ID_1, null);
Network network = createNetwork(PRIVATE_ID_1, null);
String expectedError = String.format("Could not create load balancer listeners: target group %s not found.", AwsTargetGroup.getTargetGroupName(PORT, AwsLoadBalancerScheme.INTERNAL));
Set<LoadBalancerType> types = Set.of(LoadBalancerType.PRIVATE);
List<StackResourceSummary> firstUpdateSummaries = createFirstUpdateSummaries(types);
firstUpdateSummaries.remove(TG_INDEX);
List<StackResourceSummary> secondUpdateSummaries = createFullSummaries(types);
setupMocksForUpdate(awsNetworkView, network, instances, types);
when(result.getStackResourceSummaries()).thenReturn(List.of()).thenReturn(firstUpdateSummaries).thenReturn(firstUpdateSummaries).thenReturn(secondUpdateSummaries);
CloudConnectorException exception = assertThrows(CloudConnectorException.class, () -> underTest.updateCloudformationWithLoadBalancers(ac, cloudStack, null, null));
verify(cfClient, times(1)).updateStack(any());
verify(result, times(2)).getStackResourceSummaries();
assertEquals(expectedError, exception.getMessage());
}
use of com.sequenceiq.common.api.type.LoadBalancerType in project cloudbreak by hortonworks.
the class AwsLaunchServiceLoadBalancerTest method testUpdateCloudformationWithLoadBalancerMissingLoadBalancerArn.
@Test
public void testUpdateCloudformationWithLoadBalancerMissingLoadBalancerArn() {
List<CloudResource> instances = createInstances();
AwsNetworkView awsNetworkView = createNetworkView(PRIVATE_ID_1, null);
Network network = createNetwork(PRIVATE_ID_1, null);
String expectedError = String.format("Could not create load balancer listeners: load balancer %s arn not found.", AwsLoadBalancer.getLoadBalancerName(AwsLoadBalancerScheme.INTERNAL));
Set<LoadBalancerType> types = Set.of(LoadBalancerType.PRIVATE);
List<StackResourceSummary> firstUpdateSummaries = createFirstUpdateSummaries(types);
StackResourceSummary lbSummary = firstUpdateSummaries.get(LB_INDEX);
lbSummary.setPhysicalResourceId(null);
List<StackResourceSummary> secondUpdateSummaries = createFullSummaries(types);
setupMocksForUpdate(awsNetworkView, network, instances, types);
when(result.getStackResourceSummaries()).thenReturn(List.of()).thenReturn(firstUpdateSummaries).thenReturn(firstUpdateSummaries).thenReturn(secondUpdateSummaries);
CloudConnectorException exception = assertThrows(CloudConnectorException.class, () -> underTest.updateCloudformationWithLoadBalancers(ac, cloudStack, null, null));
verify(cfClient, times(1)).updateStack(any());
verify(result, times(2)).getStackResourceSummaries();
assertEquals(expectedError, exception.getMessage());
}
Aggregations