Search in sources :

Example 1 with DiagnosticsFlowException

use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException in project cloudbreak by hortonworks.

the class DiagnosticsEnsureMachineUserHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws IOException {
    // GIVEN
    doThrow(new IOException("ex")).when(altusMachineUserService).getOrCreateDataBusCredentialIfNeeded(anyLong());
    DiagnosticParameters diagnosticParameters = new DiagnosticParameters();
    diagnosticParameters.setDestination(DiagnosticsDestination.SUPPORT);
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(ENSURE_MACHINE_USER_EVENT.selector(), STACK_ID, "crn", diagnosticParameters, Set.of(), Set.of(), Set.of());
    DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
    // THEN
    assertTrue(result.getMessage().contains("Error during diagnostics operation: UMS resource check"));
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) IOException(java.io.IOException) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 2 with DiagnosticsFlowException

use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException in project cloudbreak by hortonworks.

the class DiagnosticsSaltPillarUpdateHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doThrow(new CloudbreakOrchestratorFailedException("ex")).when(telemetryUpgradeService).upgradeTelemetrySaltPillars(anyLong(), anySet());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_PILLAR_UPDATE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters(), Set.of(), Set.of(), Set.of());
    DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
    // THEN
    assertTrue(result.getMessage().contains("Error during diagnostics operation: Salt pillar update"));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 3 with DiagnosticsFlowException

use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException in project cloudbreak by hortonworks.

the class DiagnosticsSaltStateUpdateHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException, IOException {
    // GIVEN
    doThrow(new CloudbreakOrchestratorFailedException("ex")).when(telemetryUpgradeService).upgradeTelemetrySaltStates(anyLong(), anySet());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_STATE_UPDATE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters(), Set.of(), Set.of(), Set.of());
    DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
    // THEN
    assertTrue(result.getMessage().contains("Error during diagnostics operation: Salt state update"));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 4 with DiagnosticsFlowException

use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException in project cloudbreak by hortonworks.

the class DiagnosticsSaltValidationHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doThrow(new CloudbreakOrchestratorFailedException("ex")).when(diagnosticsOperationsService).applyUnresponsiveHosts(anyLong(), any());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_VALIDATION_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters(), Set.of(), Set.of(), Set.of());
    DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
    // THEN
    assertTrue(result.getMessage().contains("Error during diagnostics operation: Salt validation"));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 5 with DiagnosticsFlowException

use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException in project cloudbreak by hortonworks.

the class DiagnosticsUpgradeTelemetryHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doThrow(new CloudbreakOrchestratorFailedException("ex")).when(telemetryUpgradeService).upgradeTelemetryComponent(anyLong(), any(), any());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(UPGRADE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters(), Set.of(), Set.of(), Set.of());
    DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
    // THEN
    assertTrue(result.getMessage().contains("Error during diagnostics operation: Upgrade telemetry"));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Aggregations

DiagnosticsFlowException (com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException)11 DiagnosticsCollectionEvent (com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent)11 DiagnosticParameters (com.sequenceiq.common.model.diagnostics.DiagnosticParameters)11 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)11 Test (org.junit.jupiter.api.Test)11 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)9 IOException (java.io.IOException)1