Search in sources :

Example 61 with StackV4Response

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"));
}
Also used : BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 62 with StackV4Response

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."));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 63 with StackV4Response

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"));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 64 with StackV4Response

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));
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Set(java.util.Set) ArgumentMatchers.anySet(org.mockito.ArgumentMatchers.anySet) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) NotFoundException(javax.ws.rs.NotFoundException) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Example 65 with StackV4Response

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));
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) Test(org.junit.jupiter.api.Test)

Aggregations

StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)101 Test (org.junit.jupiter.api.Test)26 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)22 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)19 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)14 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)13 Test (org.junit.Test)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)8 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)7 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)7 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)7 ArrayList (java.util.ArrayList)7 Test (org.testng.annotations.Test)7 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)6 TagsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response)6 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)6 TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)6 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)6