use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class SdxServiceTest method testCreateSdxClusterWithoutCloudStorageShouldNotThrownBadRequestExceptionInCaseOfInternal.
@Test
void testCreateSdxClusterWithoutCloudStorageShouldNotThrownBadRequestExceptionInCaseOfInternal() {
SdxClusterRequest sdxClusterRequest = createSdxClusterRequest("7.2.1", CUSTOM);
when(sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNullAndDetachedIsFalse(anyString(), anyString())).thenReturn(new ArrayList<>());
mockEnvironmentCall(sdxClusterRequest, CloudPlatform.AWS, null);
StackV4Request stackV4Request = new StackV4Request();
ClusterV4Request clusterV4Request = new ClusterV4Request();
stackV4Request.setCluster(clusterV4Request);
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, stackV4Request));
}
use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class SdxServiceTest method testCcmV2VersionChecker.
@ParameterizedTest(name = "Runtime {0} is compatible with CCMv2 = {1}")
@MethodSource("ccmV2Scenarios")
void testCcmV2VersionChecker(String runtime, boolean compatible) throws IOException {
SdxClusterRequest sdxClusterRequest = createSdxClusterRequest(runtime, LIGHT_DUTY);
when(sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNullAndDetachedIsFalse(anyString(), anyString())).thenReturn(new ArrayList<>());
String lightDutyJson = FileReaderUtils.readFileFromClasspath("/duties/7.2.10/aws/light_duty.json");
lenient().when(cdpConfigService.getConfigForKey(any())).thenReturn(JsonUtil.readValue(lightDutyJson, StackV4Request.class));
mockEnvironmentCall(sdxClusterRequest, CloudPlatform.MOCK, Tunnel.CCMV2);
if (!compatible) {
assertThatThrownBy(() -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, null))).isInstanceOf(BadRequestException.class).hasMessage(String.format("Runtime version %s does not support Cluster Connectivity Manager. " + "Please try creating a datalake with runtime version at least %s.", runtime, CCMV2_REQUIRED_VERSION));
} else {
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, null));
}
}
use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class SdxServiceTest method createSdxClusterRequest.
private SdxClusterRequest createSdxClusterRequest(String runtime, SdxClusterShape shape) {
SdxClusterRequest sdxClusterRequest = new SdxClusterRequest();
sdxClusterRequest.setRuntime(runtime);
sdxClusterRequest.setClusterShape(shape);
sdxClusterRequest.addTags(TAGS);
sdxClusterRequest.setEnvironment("envir");
return sdxClusterRequest;
}
use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class SdxServiceTest method testCreateSdxClusterWithoutCloudStorageShouldThrownBadRequestException.
@Test
void testCreateSdxClusterWithoutCloudStorageShouldThrownBadRequestException() {
SdxClusterRequest sdxClusterRequest = createSdxClusterRequest("7.2.1", LIGHT_DUTY);
when(sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNullAndDetachedIsFalse(anyString(), anyString())).thenReturn(new ArrayList<>());
mockEnvironmentCall(sdxClusterRequest, CloudPlatform.AWS, null);
BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, null)));
assertEquals("Cloud storage parameter is required.", badRequestException.getMessage());
}
use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class SdxServiceTest method testSdxCreateRazEnabledNotAwsOrAzure.
@Test
void testSdxCreateRazEnabledNotAwsOrAzure() {
SdxClusterRequest sdxClusterRequest = createSdxClusterRequest("7.2.2", LIGHT_DUTY);
when(sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNullAndDetachedIsFalse(anyString(), anyString())).thenReturn(new ArrayList<>());
mockEnvironmentCall(sdxClusterRequest, CloudPlatform.YARN, null);
sdxClusterRequest.setEnableRangerRaz(true);
BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, null)));
assertEquals("Provisioning Ranger Raz is only valid for Amazon Web Services and Microsoft Azure.", badRequestException.getMessage());
}
Aggregations