Search in sources :

Example 11 with SdxCcmUpgradeResponse

use of com.sequenceiq.sdx.api.model.SdxCcmUpgradeResponse in project cloudbreak by hortonworks.

the class UpgradeCcmOnDatalakeHandlerTest method testAcceptWhenUpgradeError.

@Test
void testAcceptWhenUpgradeError() {
    SdxCcmUpgradeResponse response = new SdxCcmUpgradeResponse(CcmUpgradeResponseType.ERROR, new FlowIdentifier(FlowType.FLOW, "flowId"), "reason", "datalakeCrn");
    when(sdxService.upgradeCcm(TEST_ENV_CRN)).thenReturn(response);
    underTest.accept(mockEnvironmentDtoEvent);
    verify(sdxUpgradeCcmPollerService, never()).waitForUpgradeCcm(any(), any());
    UpgradeCcmFailedEvent capturedUpgradeCcmEvent = (UpgradeCcmFailedEvent) baseNamedFlowEvent.getValue();
    assertThat(capturedUpgradeCcmEvent.getResourceName()).isEqualTo(TEST_ENV_NAME);
    assertThat(capturedUpgradeCcmEvent.getResourceId()).isEqualTo(TEST_ENV_ID);
    assertThat(capturedUpgradeCcmEvent.getResourceCrn()).isEqualTo(TEST_ENV_CRN);
    assertThat(capturedUpgradeCcmEvent.selector()).isEqualTo("FAILED_UPGRADE_CCM_EVENT");
    assertThat(capturedUpgradeCcmEvent.getEnvironmentStatus()).isEqualTo(UPGRADE_CCM_ON_DATALAKE_FAILED);
}
Also used : SdxCcmUpgradeResponse(com.sequenceiq.sdx.api.model.SdxCcmUpgradeResponse) UpgradeCcmFailedEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) Test(org.junit.jupiter.api.Test)

Aggregations

SdxCcmUpgradeResponse (com.sequenceiq.sdx.api.model.SdxCcmUpgradeResponse)11 Test (org.junit.jupiter.api.Test)8 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)4 UpgradeCcmEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent)3 OperationException (com.sequenceiq.cloudbreak.service.OperationException)1 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)1 UpgradeCcmFailedEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1