use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsPreFlightCheckHandlerTest method testDoAcceptWithClientException.
@Test
public void testDoAcceptWithClientException() throws FreeIpaClientException {
// GIVEN
given(stackService.getByIdWithListsInTransaction(STACK_ID)).willReturn(mock(Stack.class));
given(instanceMetaDataService.findNotTerminatedForStack(STACK_ID)).willReturn(metadataSet());
doThrow(new FreeIpaClientException("ex")).when(freeIpaNodeStatusService).nodeNetworkReport(any(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(freeIpaNodeStatusService, times(1)).nodeNetworkReport(any(), any());
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent 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());
DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
// THEN
assertTrue(result.getMessage().contains("Error during diagnostics operation: Salt pillar update"));
}
use of com.sequenceiq.freeipa.flow.freeipa.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());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(diagnosticsOperationsService, times(1)).applyUnresponsiveHosts(anyLong(), any());
}
Aggregations