Search in sources :

Example 26 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsSaltStateUpdateHandlerTest method testFailureEvent.

@Test
public void testFailureEvent() {
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_STATE_UPDATE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
    Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
    assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Test(org.junit.jupiter.api.Test)

Example 27 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent 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());
    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.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 28 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsSaltStateUpdateHandlerTest method testDoAccept.

@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException, IOException {
    // GIVEN
    doNothing().when(telemetryUpgradeService).upgradeTelemetrySaltStates(anyLong(), anySet());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_STATE_UPDATE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
    underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
    // THEN
    verify(telemetryUpgradeService, times(1)).upgradeTelemetrySaltStates(anyLong(), anySet());
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Event(reactor.bus.Event) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Test(org.junit.jupiter.api.Test)

Example 29 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent 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());
    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.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 30 with DiagnosticsCollectionEvent

use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsSaltValidationHandlerTest method testFailureEvent.

@Test
public void testFailureEvent() {
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_VALIDATION_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
    Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
    assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Test(org.junit.jupiter.api.Test)

Aggregations

DiagnosticsCollectionEvent (com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)58 DiagnosticParameters (com.sequenceiq.common.model.diagnostics.DiagnosticParameters)46 Test (org.junit.jupiter.api.Test)33 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)23 CommonContext (com.sequenceiq.flow.core.CommonContext)13 Map (java.util.Map)13 Bean (org.springframework.context.annotation.Bean)13 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)12 Event (reactor.bus.Event)12 DiagnosticsFlowException (com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsFlowException)10 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)9 Stack (com.sequenceiq.freeipa.entity.Stack)4 DataBusCredential (com.sequenceiq.common.api.telemetry.model.DataBusCredential)2 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)1 NodeStatusProto (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto)1 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 OrchestratorMetadataFilter (com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter)1 InstanceMetadataType (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetadataType)1