use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedRestoreAdminOperations.
@Test
public void testFailedRestoreAdminOperations() {
datalakeDRProto.AdminOperationsBackupRestoreState.Builder adminBuilder = datalakeDRProto.AdminOperationsBackupRestoreState.newBuilder().setStopServices(createStatus(FAILED_STATE, FAILURE_REASON)).setStartServices(createStatus(FAILED_STATE, FAILURE_REASON2));
datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setAdminOperations(adminBuilder);
datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
String expectedFailure = getFailureString(OperationEnum.STOP_SERVICES.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.START_SERVICES.description(), FAILURE_REASON2);
DatalakeRestoreStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeRestoreStatusResponse.State.FAILED, response.getState());
assertEquals(expectedFailure, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testRestoreLegacyFailureReason.
@Test
public void testRestoreLegacyFailureReason() {
datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setFailureReason(FAILURE_REASON);
DatalakeRestoreStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeRestoreStatusResponse.State.FAILED, response.getState());
assertEquals(FAILURE_REASON, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedHbaseRestoreSameFailureReason.
@Test
public void testFailedHbaseRestoreSameFailureReason() {
datalakeDRProto.HbaseBackupRestoreState.Builder hbaseBuilder = datalakeDRProto.HbaseBackupRestoreState.newBuilder().setAtlasJanusTable(createStatus(FAILED_STATE, FAILURE_REASON)).setAtlasEntityAuditEventTable(createStatus(FAILED_STATE, FAILURE_REASON));
datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setHbase(hbaseBuilder);
datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
String expectedFailure = getFailureString(OperationEnum.HBASE.description(), FAILURE_REASON);
DatalakeRestoreStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeRestoreStatusResponse.State.FAILED, response.getState());
assertEquals(expectedFailure, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedSolrRestoreSameFailureReasonWithDelete.
@Test
public void testFailedSolrRestoreSameFailureReasonWithDelete() {
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)).setEdgeIndexCollectionDelete(createStatus(FAILED_STATE, FAILURE_REASON2)).setFulltextIndexCollectionDelete(createStatus(FAILED_STATE, FAILURE_REASON2)).setRangerAuditsCollectionDelete(createStatus(FAILED_STATE, FAILURE_REASON2)).setVertexIndexCollectionDelete(createStatus(FAILED_STATE, FAILURE_REASON2));
datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setSolr(solrBuilder);
datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
String expectedFailure = getFailureString(OperationEnum.SOLR.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.SOLR_DELETE.description(), FAILURE_REASON2);
DatalakeRestoreStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeRestoreStatusResponse.State.FAILED, response.getState());
assertEquals(expectedFailure, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.
the class DatalakeRestoreActionsTest method testRestoreWithNoFlowChain.
@Test
public void testRestoreWithNoFlowChain() throws Exception {
when(sdxBackupRestoreService.triggerDatalakeRestore(eq(OLD_SDX_ID), any(), any(), eq(USER_CRN))).thenReturn(new DatalakeRestoreStatusResponse(BACKUP_ID, RESTORE_ID, State.STARTED, Optional.empty()));
DatalakeTriggerRestoreEvent event = new DatalakeTriggerRestoreEvent(DATALAKE_TRIGGER_RESTORE_EVENT.event(), OLD_SDX_ID, DATALAKE_NAME, USER_CRN, null, BACKUP_LOCATION, null, DatalakeRestoreFailureReason.RESTORE_ON_RESIZE);
AbstractAction action = (AbstractAction) underTest.triggerDatalakeRestore();
initActionPrivateFields(action);
AbstractActionTestSupport testSupport = new AbstractActionTestSupport(action);
SdxContext context = SdxContext.from(new FlowParameters(FLOW_ID, FLOW_ID, null), event);
testSupport.doExecute(context, event, new HashMap());
ArgumentCaptor<DatalakeDatabaseRestoreStartEvent> captor = ArgumentCaptor.forClass(DatalakeDatabaseRestoreStartEvent.class);
verify(reactorEventFactory, times(1)).createEvent(any(), captor.capture());
DatalakeDatabaseRestoreStartEvent captorValue = captor.getValue();
Assertions.assertEquals(OLD_SDX_ID, captorValue.getResourceId());
}
Aggregations