Search in sources :

Example 1 with StackCcmUpgradeV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response in project cloudbreak by hortonworks.

the class SdxCcmUpgradeServiceTest method testInitAndWaitForStackUpgrade.

@Test
void testInitAndWaitForStackUpgrade() {
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn:altus:iam:us-west-1:altus:user:__internal__actor__");
    FlowIdentifier flowId = new FlowIdentifier(FlowType.FLOW, "pollableId");
    StackCcmUpgradeV4Response upgradeResponse = new StackCcmUpgradeV4Response(flowId);
    when(stackV4Endpoint.upgradeCcmByCrnInternal(eq(0L), eq(STACK_CRN), any())).thenReturn(upgradeResponse);
    PollingConfig pc = new PollingConfig(1L, TimeUnit.HOURS, 1L, TimeUnit.HOURS);
    SdxCluster sdx = getSdxCluster();
    underTest.initAndWaitForStackUpgrade(sdx, pc);
    verify(stackV4Endpoint).upgradeCcmByCrnInternal(any(), eq(STACK_CRN), any());
    verify(cloudbreakPoller).pollCcmUpgradeUntilAvailable(sdx, pc);
}
Also used : StackCcmUpgradeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with StackCcmUpgradeV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response in project cloudbreak by hortonworks.

the class SdxCcmUpgradeService method initAndWaitForStackUpgrade.

public void initAndWaitForStackUpgrade(SdxCluster sdxCluster, PollingConfig pollingConfig) {
    String stackCrn = sdxCluster.getStackCrn();
    LOGGER.debug("Initiating CCM upgrade on stack CRN {} for datalake {}", stackCrn, sdxCluster.getName());
    String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
    StackCcmUpgradeV4Response upgradeResponse = ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> stackV4Endpoint.upgradeCcmByCrnInternal(0L, stackCrn, initiatorUserCrn));
    cloudbreakFlowService.saveLastCloudbreakFlowChainId(sdxCluster, upgradeResponse.getFlowIdentifier());
    LOGGER.debug("Waiting for CCM upgrade on stack CRN {} for datalake {}", stackCrn, sdxCluster.getName());
    cloudbreakPoller.pollCcmUpgradeUntilAvailable(sdxCluster, pollingConfig);
}
Also used : StackCcmUpgradeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response)

Example 3 with StackCcmUpgradeV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response in project cloudbreak by hortonworks.

the class StackV4ControllerTest method testCcmUpgrade.

@Test
public void testCcmUpgrade() {
    FlowIdentifier actual = new FlowIdentifier(FlowType.FLOW, "1");
    when(stackCcmUpgradeService.upgradeCcm(NameOrCrn.ofCrn(STACK_CRN))).thenReturn(actual);
    StackCcmUpgradeV4Response result = underTest.upgradeCcmByCrnInternal(WORKSPACE_ID, STACK_CRN, USER_CRN);
    Assertions.assertSame(actual, result.getFlowIdentifier());
}
Also used : StackCcmUpgradeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) Test(org.junit.jupiter.api.Test)

Aggregations

StackCcmUpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response)3 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)2 Test (org.junit.jupiter.api.Test)2 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 PollingConfig (com.sequenceiq.datalake.service.sdx.PollingConfig)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1