use of com.amazonaws.services.cloudformation.model.StackResourceSummary 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());
}
use of com.amazonaws.services.cloudformation.model.StackResourceSummary in project cloudbreak by hortonworks.
the class AwsLaunchServiceLoadBalancerTest method testUpdateCloudformationLoadBalancerCreateFailure.
@Test
public void testUpdateCloudformationLoadBalancerCreateFailure() {
List<CloudResource> instances = createInstances();
AwsNetworkView awsNetworkView = createNetworkView(PRIVATE_ID_1, null);
Network network = createNetwork(PRIVATE_ID_1, null);
Set<LoadBalancerType> types = Set.of(LoadBalancerType.PRIVATE);
List<StackResourceSummary> firstUpdateSummaries = createFirstUpdateSummaries(types);
List<StackResourceSummary> secondUpdateSummaries = createFullSummaries(types);
secondUpdateSummaries.get(LB_INDEX).setResourceStatus(ResourceStatus.CREATE_FAILED);
setupMocksForUpdate(awsNetworkView, network, instances, types);
when(result.getStackResourceSummaries()).thenReturn(List.of()).thenReturn(firstUpdateSummaries).thenReturn(firstUpdateSummaries).thenReturn(secondUpdateSummaries);
when(ac.getCloudContext()).thenReturn(cloudContext);
when(cloudContext.getLocation()).thenReturn(location);
when(location.getAvailabilityZone()).thenReturn(availabilityZone("az1"));
List<CloudResourceStatus> statuses = underTest.updateCloudformationWithLoadBalancers(ac, cloudStack, null, null);
assertEquals(1, statuses.size());
assertEquals(com.sequenceiq.cloudbreak.cloud.model.ResourceStatus.FAILED, statuses.get(0).getStatus());
assertEquals(FAILED, statuses.get(0).getCloudResource().getStatus());
assertEquals(ELASTIC_LOAD_BALANCER, statuses.get(0).getCloudResource().getType());
}
use of com.amazonaws.services.cloudformation.model.StackResourceSummary in project cloudbreak by hortonworks.
the class AwsLaunchServiceLoadBalancerTest method testUpdateCloudformationWithLoadBalancerMissingLoadBalancer.
@Test
public void testUpdateCloudformationWithLoadBalancerMissingLoadBalancer() {
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 not found.", AwsLoadBalancer.getLoadBalancerName(AwsLoadBalancerScheme.INTERNAL));
Set<LoadBalancerType> types = Set.of(LoadBalancerType.PRIVATE);
List<StackResourceSummary> firstUpdateSummaries = createFirstUpdateSummaries(types);
firstUpdateSummaries.remove(LB_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.amazonaws.services.cloudformation.model.StackResourceSummary in project cloudbreak by hortonworks.
the class AwsLaunchServiceLoadBalancerTest method testUpdateCloudformationTargetGroupCreateFailure.
@Test
public void testUpdateCloudformationTargetGroupCreateFailure() {
List<CloudResource> instances = createInstances();
AwsNetworkView awsNetworkView = createNetworkView(PRIVATE_ID_1, null);
Network network = createNetwork(PRIVATE_ID_1, null);
Set<LoadBalancerType> types = Set.of(LoadBalancerType.PRIVATE);
List<StackResourceSummary> firstUpdateSummaries = createFirstUpdateSummaries(types);
List<StackResourceSummary> secondUpdateSummaries = createFullSummaries(types);
secondUpdateSummaries.get(TG_INDEX).setResourceStatus(ResourceStatus.CREATE_FAILED);
setupMocksForUpdate(awsNetworkView, network, instances, Set.of(LoadBalancerType.PRIVATE));
when(result.getStackResourceSummaries()).thenReturn(List.of()).thenReturn(firstUpdateSummaries).thenReturn(firstUpdateSummaries).thenReturn(secondUpdateSummaries);
when(ac.getCloudContext()).thenReturn(cloudContext);
when(cloudContext.getLocation()).thenReturn(location);
when(location.getAvailabilityZone()).thenReturn(availabilityZone("az1"));
List<CloudResourceStatus> statuses = underTest.updateCloudformationWithLoadBalancers(ac, cloudStack, null, null);
assertEquals(1, statuses.size());
assertEquals(com.sequenceiq.cloudbreak.cloud.model.ResourceStatus.FAILED, statuses.get(0).getStatus());
assertEquals(FAILED, statuses.get(0).getCloudResource().getStatus());
assertEquals(ELASTIC_LOAD_BALANCER, statuses.get(0).getCloudResource().getType());
}
use of com.amazonaws.services.cloudformation.model.StackResourceSummary in project cloudbreak by hortonworks.
the class AwsLaunchServiceLoadBalancerTest method testUpdateCloudformationListenerCreateFailure.
@Test
public void testUpdateCloudformationListenerCreateFailure() {
List<CloudResource> instances = createInstances();
AwsNetworkView awsNetworkView = createNetworkView(PRIVATE_ID_1, null);
Network network = createNetwork(PRIVATE_ID_1, null);
Set<LoadBalancerType> types = Set.of(LoadBalancerType.PRIVATE);
List<StackResourceSummary> firstUpdateSummaries = createFirstUpdateSummaries(types);
List<StackResourceSummary> secondUpdateSummaries = createFullSummaries(types);
secondUpdateSummaries.get(LIS_INDEX).setResourceStatus(ResourceStatus.CREATE_FAILED);
setupMocksForUpdate(awsNetworkView, network, instances, Set.of(LoadBalancerType.PRIVATE));
when(result.getStackResourceSummaries()).thenReturn(List.of()).thenReturn(firstUpdateSummaries).thenReturn(firstUpdateSummaries).thenReturn(secondUpdateSummaries);
when(ac.getCloudContext()).thenReturn(cloudContext);
when(cloudContext.getLocation()).thenReturn(location);
when(location.getAvailabilityZone()).thenReturn(availabilityZone("az1"));
List<CloudResourceStatus> statuses = underTest.updateCloudformationWithLoadBalancers(ac, cloudStack, null, null);
assertEquals(1, statuses.size());
assertEquals(com.sequenceiq.cloudbreak.cloud.model.ResourceStatus.FAILED, statuses.get(0).getStatus());
assertEquals(FAILED, statuses.get(0).getCloudResource().getStatus());
assertEquals(ELASTIC_LOAD_BALANCER, statuses.get(0).getCloudResource().getType());
}
Aggregations