use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class CcmUpgradeFlowIntegrationTest method testCcmUpgradeWhenSuccessful.
@Test
public void testCcmUpgradeWhenSuccessful() {
FlowIdentifier flowIdentifier = triggerFlow();
letItFlow(flowIdentifier);
ArgumentCaptor<FlowLog> flowLog = ArgumentCaptor.forClass(FlowLog.class);
verify(flowLogRepository, times(2)).save(flowLog.capture());
Assertions.assertTrue(flowLog.getAllValues().stream().anyMatch(f -> f.getFinalized()), "flow has not finalized");
verify(ccmUpgradeService, times(1)).reregister(STACK_ID);
verify(ccmUpgradeService, times(1)).unregister(STACK_ID);
verify(ccmUpgradeService, times(1)).prepare(STACK_ID);
verify(ccmUpgradeService, times(1)).removeAutoSsh(STACK_ID);
verify(ccmUpgradeService, never()).ccmUpgradeFailed(STACK_ID);
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class ResizeRecoveryService method validateRecovery.
public SdxRecoverableResponse validateRecovery(SdxCluster sdxCluster) {
Optional<FlowLog> flowLogOptional = flow2Handler.getFirstStateLogfromLatestFlow(sdxCluster.getId());
if (flowLogOptional.isEmpty()) {
return new SdxRecoverableResponse("No recent actions on this cluster", RecoveryStatus.NON_RECOVERABLE);
}
if (entitlementService.isDatalakeResizeRecoveryEnabled(ThreadBasedUserCrnProvider.getAccountId())) {
if (!DatalakeResizeFlowEventChainFactory.class.getSimpleName().equals(flowChainLogService.getFlowChainType(flowLogOptional.get().getFlowChainId()))) {
return new SdxRecoverableResponse("No recent resize operation", RecoveryStatus.NON_RECOVERABLE);
}
} else {
return new SdxRecoverableResponse("Resize Recovery entitlement not enabled", RecoveryStatus.NON_RECOVERABLE);
}
SdxStatusEntity actualStatusForSdx = sdxStatusService.getActualStatusForSdx(sdxCluster);
switch(actualStatusForSdx.getStatus()) {
case STOP_FAILED:
return new SdxRecoverableResponse("Resize can be recovered from a failed stop", RecoveryStatus.RECOVERABLE);
case PROVISIONING_FAILED:
return new SdxRecoverableResponse("Failed to provision, recovery will restart original data lake, and delete the new one", RecoveryStatus.RECOVERABLE);
case DATALAKE_RESTORE_FAILED:
return new SdxRecoverableResponse("Failed to restore backup to new data lake, recovery will restart original data lake, and delete the new one", RecoveryStatus.RECOVERABLE);
case DELETE_FAILED:
return new SdxRecoverableResponse("Failed to delete original data lake, not a recoverable error", RecoveryStatus.NON_RECOVERABLE);
default:
return new SdxRecoverableResponse("Resize can not be recovered from this point", RecoveryStatus.NON_RECOVERABLE);
}
}
Aggregations