Search in sources :

Example 1 with SdxRepairSettings

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);
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) SdxRepairRequest(com.sequenceiq.sdx.api.model.SdxRepairRequest) SdxRepairSettings(com.sequenceiq.datalake.settings.SdxRepairSettings) Test(org.junit.jupiter.api.Test)

Example 2 with SdxRepairSettings

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);
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) SdxRepairRequest(com.sequenceiq.sdx.api.model.SdxRepairRequest) SdxRepairSettings(com.sequenceiq.datalake.settings.SdxRepairSettings) Test(org.junit.jupiter.api.Test)

Example 3 with SdxRepairSettings

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());
}
Also used : SdxRepairStartEvent(com.sequenceiq.datalake.flow.repair.event.SdxRepairStartEvent) SdxRepairSettings(com.sequenceiq.datalake.settings.SdxRepairSettings)

Aggregations

SdxRepairSettings (com.sequenceiq.datalake.settings.SdxRepairSettings)3 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)2 SdxRepairRequest (com.sequenceiq.sdx.api.model.SdxRepairRequest)2 Test (org.junit.jupiter.api.Test)2 SdxRepairStartEvent (com.sequenceiq.datalake.flow.repair.event.SdxRepairStartEvent)1