Search in sources :

Example 1 with DatalakeBackupStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.

the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedRestore.

@Test
public void testFailedRestore() {
    datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState("FAILED").setFailureReason(FAILURE_REASON);
    DatalakeBackupStatusResponse response = underTest.convert(builder.build());
    assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
    assertEquals(FAILURE_REASON, response.getFailureReason());
    assert response.isComplete();
}
Also used : DatalakeBackupStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse) Test(org.junit.Test)

Example 2 with DatalakeBackupStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.

the class SdxBackupRestoreServiceTest method triggerDatabaseBackupInternalSuccess.

@Test
public void triggerDatabaseBackupInternalSuccess() {
    String drOperationId = UUID.randomUUID().toString();
    when(datalakeDrClient.triggerBackup(any(), any(), any(), any())).thenReturn(new DatalakeBackupStatusResponse(drOperationId, DatalakeBackupStatusResponse.State.IN_PROGRESS, Optional.empty()));
    when(sdxClusterRepository.findById(sdxCluster.getId())).thenReturn(Optional.of(sdxCluster));
    DatalakeBackupStatusResponse backupResponse = sdxBackupRestoreService.triggerDatalakeBackup(sdxCluster.getId(), BACKUP_LOCATION, BACKUP_NAME, USER_CRN);
    assertNotNull(backupResponse);
    assertEquals(drOperationId, backupResponse.getBackupId());
    assertTrue(isUUID(backupResponse.getBackupId()));
}
Also used : DatalakeBackupStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Example 3 with DatalakeBackupStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.

the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedSolrBackupDifferentFailureReasons.

@Test
public void testFailedSolrBackupDifferentFailureReasons() {
    datalakeDRProto.SolrBackupRestoreState.Builder solrBuilder = datalakeDRProto.SolrBackupRestoreState.newBuilder().setEdgeIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setFulltextIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON2));
    datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setSolr(solrBuilder);
    datalakeDRProto.BackupDatalakeStatusResponse.Builder builder = datalakeDRProto.BackupDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
    String expectedFailure = getFailureString(OperationEnum.SOLR_EDGE_INDEX.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.SOLR_FULLTEXT_INDEX.description(), FAILURE_REASON2);
    DatalakeBackupStatusResponse response = underTest.convert(builder.build());
    assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
    assertEquals(expectedFailure, response.getFailureReason());
    assert response.isComplete();
}
Also used : DatalakeBackupStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse) Test(org.junit.Test)

Example 4 with DatalakeBackupStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.

the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedDatabaseBackup.

@Test
public void testFailedDatabaseBackup() {
    datalakeDRProto.DatabaseBackupRestoreState.Builder databaseBuilder = datalakeDRProto.DatabaseBackupRestoreState.newBuilder().setDatabase(createStatus(FAILED_STATE, FAILURE_REASON));
    datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setDatabase(databaseBuilder);
    datalakeDRProto.BackupDatalakeStatusResponse.Builder builder = datalakeDRProto.BackupDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
    String expectedFailure = getFailureString(OperationEnum.DATABASE.description(), FAILURE_REASON);
    DatalakeBackupStatusResponse response = underTest.convert(builder.build());
    assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
    assertEquals(expectedFailure, response.getFailureReason());
    assert response.isComplete();
}
Also used : DatalakeBackupStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse) Test(org.junit.Test)

Example 5 with DatalakeBackupStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.

the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedSolrBackupSameFailureReason.

@Test
public void testFailedSolrBackupSameFailureReason() {
    datalakeDRProto.SolrBackupRestoreState.Builder solrBuilder = datalakeDRProto.SolrBackupRestoreState.newBuilder().setEdgeIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setFulltextIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setRangerAuditsCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setVertexIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON));
    datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setSolr(solrBuilder);
    datalakeDRProto.BackupDatalakeStatusResponse.Builder builder = datalakeDRProto.BackupDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
    String expectedFailure = getFailureString(OperationEnum.SOLR.description(), FAILURE_REASON);
    DatalakeBackupStatusResponse response = underTest.convert(builder.build());
    assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
    assertEquals(expectedFailure, response.getFailureReason());
    assert response.isComplete();
}
Also used : DatalakeBackupStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse) Test(org.junit.Test)

Aggregations

DatalakeBackupStatusResponse (com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse)17 Test (org.junit.Test)13 PollerStoppedException (com.dyngr.exception.PollerStoppedException)1 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 SdxContext (com.sequenceiq.datalake.flow.SdxContext)1 DatalakeTriggerBackupEvent (com.sequenceiq.datalake.flow.dr.backup.event.DatalakeTriggerBackupEvent)1 AbstractSdxAction (com.sequenceiq.datalake.service.AbstractSdxAction)1 FlowParameters (com.sequenceiq.flow.core.FlowParameters)1 SdxBackupStatusResponse (com.sequenceiq.sdx.api.model.SdxBackupStatusResponse)1 SdxRestoreStatusResponse (com.sequenceiq.sdx.api.model.SdxRestoreStatusResponse)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Test (org.junit.jupiter.api.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Bean (org.springframework.context.annotation.Bean)1 StateContext (org.springframework.statemachine.StateContext)1