use of com.sequenceiq.datalake.settings.SdxRepairSettings in project cloudbreak by hortonworks.
the class SdxRepairServiceTest method triggerHostGroupBasedCloudbreakRepair.
@Test
public void triggerHostGroupBasedCloudbreakRepair() {
SdxCluster cluster = new SdxCluster();
cluster.setId(CLUSTER_ID.incrementAndGet());
cluster.setInitiatorUserCrn(USER_CRN);
cluster.setClusterName(CLUSTER_NAME);
cluster.setAccountId("accountid");
SdxRepairRequest sdxRepairRequest = new SdxRepairRequest();
sdxRepairRequest.setHostGroupNames(List.of("master"));
SdxRepairSettings sdxRepairSettings = SdxRepairSettings.from(sdxRepairRequest);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
doNothing().when(cloudbreakFlowService).saveLastCloudbreakFlowChainId(any(), any());
underTest.startRepairInCb(cluster, sdxRepairSettings);
verify(stackV4Endpoint).repairClusterInternal(eq(0L), eq(CLUSTER_NAME), captor.capture(), nullable(String.class));
assertEquals(List.of("master"), captor.getValue().getHostGroups());
assertNull(captor.getValue().getNodes());
verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", cluster);
}
use of com.sequenceiq.datalake.settings.SdxRepairSettings in project cloudbreak by hortonworks.
the class SdxRepairServiceTest method triggerNodeIdBasedCloudbreakRepair.
@Test
public void triggerNodeIdBasedCloudbreakRepair() {
SdxCluster cluster = new SdxCluster();
cluster.setId(CLUSTER_ID.incrementAndGet());
cluster.setInitiatorUserCrn(USER_CRN);
cluster.setClusterName(CLUSTER_NAME);
cluster.setAccountId("accountid");
SdxRepairRequest sdxRepairRequest = new SdxRepairRequest();
sdxRepairRequest.setNodesIds(List.of("node1"));
SdxRepairSettings sdxRepairSettings = SdxRepairSettings.from(sdxRepairRequest);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
doNothing().when(cloudbreakFlowService).saveLastCloudbreakFlowChainId(any(), any());
underTest.startRepairInCb(cluster, sdxRepairSettings);
verify(stackV4Endpoint).repairClusterInternal(eq(0L), eq(CLUSTER_NAME), captor.capture(), nullable(String.class));
assertEquals(List.of("node1"), captor.getValue().getNodes().getIds());
assertNull(captor.getValue().getHostGroups());
verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_IN_PROGRESS, "Datalake repair in progress", cluster);
}
use of com.sequenceiq.datalake.settings.SdxRepairSettings in project cloudbreak by hortonworks.
the class SdxReactorFlowManager method triggerSdxRepairFlow.
public FlowIdentifier triggerSdxRepairFlow(SdxCluster cluster, SdxRepairRequest repairRequest) {
LOGGER.info("Trigger Datalake repair for: {} with settings: {}", cluster, repairRequest);
SdxRepairSettings settings = SdxRepairSettings.from(repairRequest);
String selector = SDX_REPAIR_EVENT.event();
String userId = ThreadBasedUserCrnProvider.getUserCrn();
return notify(selector, new SdxRepairStartEvent(selector, cluster.getId(), userId, settings), cluster.getClusterName());
}
Aggregations