use of com.sequenceiq.environment.network.dto.AwsParams in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkHasTwoSubnetSubnetMetasHasThreeSubnets.
@Test
void testValidateDuringRequestWhenNetworkHasTwoSubnetSubnetMetasHasThreeSubnets() {
AwsParams awsParams = getAwsParams();
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, getAwsParams(), null, awsParams.getVpcId(), null, 2, RegistrationType.EXISTING);
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setName(ENV_NAME);
environmentDto.setNetwork(networkDto);
EnvironmentValidationDto environmentValidationDto = EnvironmentValidationDto.builder().withEnvironmentDto(environmentDto).build();
when(cloudNetworkService.retrieveSubnetMetadata(environmentDto, networkDto)).thenReturn(new LinkedHashMap<>());
underTest.validateDuringFlow(environmentValidationDto, networkDto, validationResultBuilder);
NetworkTestUtils.checkErrorsPresent(validationResultBuilder, List.of("Subnets of the environment (someenv) are not found in the VPC (key1, key0). All subnets are expected to belong to the same VPC"));
}
use of com.sequenceiq.environment.network.dto.AwsParams in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkHasTwoSubnetsWithSameAvailabilityZone.
@Test
void testValidateDuringRequestWhenNetworkHasTwoSubnetsWithSameAvailabilityZone() {
AwsParams awsParams = getAwsParams();
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, awsParams, null, awsParams.getVpcId(), null, 2, RegistrationType.EXISTING);
Map<String, CloudSubnet> subnetMetas = new HashMap<>();
for (int i = 0; i < 2; i++) {
subnetMetas.put("key" + i, NetworkTestUtils.getCloudSubnet("eu-west-1-a"));
}
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setNetwork(networkDto);
EnvironmentValidationDto environmentValidationDto = EnvironmentValidationDto.builder().withEnvironmentDto(environmentDto).build();
when(cloudNetworkService.retrieveSubnetMetadata(environmentDto, networkDto)).thenReturn(subnetMetas);
underTest.validateDuringFlow(environmentValidationDto, networkDto, validationResultBuilder);
NetworkTestUtils.checkErrorsPresent(validationResultBuilder, List.of("The Subnets in the VPC (eu-west-1-a) should be present at least in two different availability zones, " + "but they are present only in availability zone name, name. Please add subnets to the environment " + "from the required number of different availability zones."));
}
Aggregations