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);
}
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);
}
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());
}
Aggregations