use of com.sequenceiq.cloudbreak.core.flow2.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(), 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"));
}
use of com.sequenceiq.cloudbreak.core.flow2.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(), Set.of(), Set.of(), Set.of());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
use of com.sequenceiq.cloudbreak.core.flow2.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(), Set.of(), Set.of(), Set.of());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(telemetryUpgradeService, times(1)).upgradeTelemetrySaltStates(anyLong(), anySet());
}
use of com.sequenceiq.cloudbreak.core.flow2.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(), Set.of(), Set.of(), Set.of());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsSaltValidationHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
given(diagnosticsOperationsService.applyUnresponsiveHosts(anyLong(), any())).willReturn(new DiagnosticParameters());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_VALIDATION_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters(), Set.of(), Set.of(), Set.of());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(diagnosticsOperationsService, times(1)).applyUnresponsiveHosts(anyLong(), any());
}
Aggregations