use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAwsAndNoInstanceGroups.
@Test
void setupInstanceVolumeEncryptionTestWhenAwsAndNoInstanceGroups() {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setCloudPlatform(CloudPlatform.AWS.name());
List<InstanceGroupV4Request> instanceGroups = new ArrayList<>();
when(stackV4Request.getInstanceGroups()).thenReturn(instanceGroups);
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
assertThat(instanceGroups).isEmpty();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAwsAndCustomEncryptionParameters.
@Test
void setupInstanceVolumeEncryptionTestWhenAwsAndCustomEncryptionParameters() {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setCloudPlatform(CloudPlatform.AWS.name());
envResponse.setAws(AwsEnvironmentParameters.builder().withAwsDiskEncryptionParameters(AwsDiskEncryptionParameters.builder().withEncryptionKeyArn(AWS_ENCRYPTION_KEY).build()).build());
InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
verifyAwsEncryption(instanceGroupV4Request.getTemplate(), EncryptionType.CUSTOM, AWS_ENCRYPTION_KEY);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAzureAndDiskEncryptionSetIdAndNoEncryptionParameters.
@Test
void setupInstanceVolumeEncryptionTestWhenAzureAndDiskEncryptionSetIdAndNoEncryptionParameters() {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setCloudPlatform(CloudPlatform.AZURE.name());
envResponse.setAzure(AzureEnvironmentParameters.builder().withResourceEncryptionParameters(AzureResourceEncryptionParameters.builder().withDiskEncryptionSetId(DISK_ENCRYPTION_SET_ID).withEncryptionKeyUrl(ENCRYPTION_KEY).build()).build());
InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
InstanceTemplateV4Request instanceTemplateV4Request = instanceGroupV4Request.getTemplate();
instanceTemplateV4Request.createAzure();
when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
verifyAzureEncryption(instanceTemplateV4Request, EncryptionType.CUSTOM, DISK_ENCRYPTION_SET_ID, ENCRYPTION_KEY);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAwsAndNoInstanceTemplateParameters.
@Test
void setupInstanceVolumeEncryptionTestWhenAwsAndNoInstanceTemplateParameters() {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setCloudPlatform(CloudPlatform.AWS.name());
InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
verifyAwsEncryption(instanceGroupV4Request.getTemplate(), EncryptionType.DEFAULT);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAwsAndEncryptionParameters.
@ParameterizedTest(name = "{0}")
@MethodSource("encryptionTypeDataProvider")
void setupInstanceVolumeEncryptionTestWhenAwsAndEncryptionParameters(String testCaseName, EncryptionType encryptionType, String encryptionKey, EncryptionType encryptionTypeExpected, String encryptionKeyExpected) {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setCloudPlatform(CloudPlatform.AWS.name());
InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
InstanceTemplateV4Request instanceTemplateV4Request = instanceGroupV4Request.getTemplate();
if (encryptionKey == null) {
instanceTemplateV4Request.createAws().setEncryption(createAwsEncryptionV4Parameters(encryptionType));
} else {
instanceTemplateV4Request.createAws().setEncryption(createAwsEncryptionV4Parameters(encryptionType, encryptionKey));
}
when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
if (encryptionKeyExpected == null) {
verifyAwsEncryption(instanceTemplateV4Request, encryptionTypeExpected);
} else {
verifyAwsEncryption(instanceTemplateV4Request, encryptionTypeExpected, encryptionKeyExpected);
}
}
Aggregations