use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithoutTelemetry.
@Test
void testWithoutTelemetry() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("Telemetry is not enabled for Data Lake"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithSupportDestination.
@Test
void testWithSupportDestination() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.SUPPORT);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
stackV4Response.setTelemetry(telemetry);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("Destination SUPPORT is not supported yet."));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithCloudStorageWithEmptyLogging.
@Test
void testWithCloudStorageWithEmptyLogging() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
LoggingResponse logging = new LoggingResponse();
telemetry.setLogging(logging);
stackV4Response.setTelemetry(telemetry);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("S3, ABFS or GCS cloud storage logging setting should be enabled for Data Lake"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class ProvisionerServiceTest method startProvisioning.
@Test
void startProvisioning() {
long clusterId = CLUSTER_ID.incrementAndGet();
SdxCluster sdxCluster = generateValidSdxCluster(clusterId);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setId(1L);
when(stackV4Endpoint.getByCrn(anyLong(), nullable(String.class), nullable(Set.class))).thenThrow(new NotFoundException());
when(stackV4Endpoint.postInternal(anyLong(), any(StackV4Request.class), nullable(String.class))).thenReturn(stackV4Response);
when(sdxService.getById(clusterId)).thenReturn(sdxCluster);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn:cdp:datahub:us-west-1:altus:user:__internal__actor__");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.startStackProvisioning(clusterId, getEnvironmentResponse()));
verify(cloudbreakFlowService).saveLastCloudbreakFlowChainId(sdxCluster, stackV4Response.getFlowIdentifier());
verify(sdxClusterRepository, times(1)).save(any(SdxCluster.class));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class ProvisionerServiceTest method waitCloudbreakClusterDeletionButTimeout.
@Test
void waitCloudbreakClusterDeletionButTimeout() {
long clusterId = CLUSTER_ID.incrementAndGet();
SdxCluster sdxCluster = generateValidSdxCluster(clusterId);
when(sdxService.getById(clusterId)).thenReturn(sdxCluster);
StackV4Response firstStackV4Response = new StackV4Response();
firstStackV4Response.setStatus(Status.AVAILABLE);
when(stackV4Endpoint.get(anyLong(), eq(sdxCluster.getClusterName()), anySet(), anyString())).thenReturn(firstStackV4Response);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn:cdp:datahub:us-west-1:altus:user:__internal__actor__");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
PollingConfig pollingConfig = new PollingConfig(10, TimeUnit.MILLISECONDS, 200, TimeUnit.MILLISECONDS);
Assertions.assertThrows(PollerStoppedException.class, () -> underTest.waitCloudbreakClusterDeletion(clusterId, pollingConfig));
}
Aggregations