use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPrivateTest method testFilterNonHAPrivateSubnetWhenOnlyPrivateSubnetPresentedShouldReturnPrivateSubnets.
@Test
public void testFilterNonHAPrivateSubnetWhenOnlyPrivateSubnetPresentedShouldReturnPrivateSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPrivateSubnet(AZ_A).withPrivateSubnet(AZ_B).withPrivateSubnet(AZ_B).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 1);
verify(subnetSelectorService, times(1)).collectPrivateSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(3));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPrivateTest method testFilterHAMixedSubnetWhenOnlyPrivateSubnetHasUniqueAZPresentedShouldReturnOnlyPrivateSubnets.
@Test
public void testFilterHAMixedSubnetWhenOnlyPrivateSubnetHasUniqueAZPresentedShouldReturnOnlyPrivateSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPrivateSubnet(AZ_A).withPrivateSubnet(AZ_B).withPublicSubnet(AZ_B).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 3);
verify(subnetSelectorService, times(1)).collectPrivateSubnets(anyCollection());
verify(subnetSelectorService, times(1)).collectPublicSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(2));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPrivateTest method testFilterNonHAPrivateSubnetWhenMixedSubnetWithDifferentAzPresentedShouldReturnPrivateAnPublicSubnets.
@Test
public void testFilterNonHAPrivateSubnetWhenMixedSubnetWithDifferentAzPresentedShouldReturnPrivateAnPublicSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPrivateSubnet(AZ_A).withPrivateSubnet(AZ_B).withPublicSubnet(AZ_C).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 1);
verify(subnetSelectorService, times(1)).collectPrivateSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(2));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class GcpSubnetSelectorServiceTest method testSelectWhenNoErrorShouldReturnFirstSubnet.
@Test
public void testSelectWhenNoErrorShouldReturnFirstSubnet() {
SubnetSelectionResult select = underTest.select(generateSubnetMetas(1), SubnetSelectionParameters.builder().build());
Assert.assertEquals(1, select.getResult().size());
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class GcpSubnetSelectorServiceTest method testSelectWhenNoSubnetMetadataShouldReturnError.
@Test
public void testSelectWhenNoSubnetMetadataShouldReturnError() {
SubnetSelectionResult select = underTest.select(generateSubnetMetas(0), SubnetSelectionParameters.builder().build());
Assert.assertEquals(select.getErrorMessage(), "GCP subnet selection: there are no subnets to choose from.");
}
Aggregations