Search in sources :

Example 16 with StackV4Response

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

the class DistroXRepairAction method action.

@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
    DistroXRepairV1Request distroXRepairV1Request = createRepairRequest();
    Log.when(LOGGER, format(" Starting repair on DistroX: %s ", testDto.getName()));
    Log.whenJson(LOGGER, " DistroX  repair request: ", distroXRepairV1Request);
    FlowIdentifier flowIdentifier = client.getDefaultClient().distroXV1Endpoint().repairClusterByName(testDto.getName(), distroXRepairV1Request);
    testDto.setFlow("DistroX repair flow identifier", flowIdentifier);
    StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), Collections.emptySet());
    testDto.setResponse(stackV4Response);
    Log.whenJson(LOGGER, " DistroX repair response: ", stackV4Response);
    return testDto;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXRepairV1Request(com.sequenceiq.distrox.api.v1.distrox.model.DistroXRepairV1Request) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Example 17 with StackV4Response

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

the class DistroXRepairInstancesAction method action.

@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
    DistroXRepairV1Request distroXRepairV1Request = createRepairRequest(testDto.getRepairableInstanceIds().orElse(Collections.emptyList()));
    Log.when(LOGGER, format("Starting repair instances on DistroX: %s ", testDto.getName()));
    Log.whenJson(LOGGER, "DistroX instance id based repair request: ", distroXRepairV1Request);
    FlowIdentifier flowIdentifier = client.getDefaultClient().distroXV1Endpoint().repairClusterByName(testDto.getName(), distroXRepairV1Request);
    testDto.setFlow("DistroX instance id based repair flow identifier", flowIdentifier);
    StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), Collections.emptySet());
    testDto.setResponse(stackV4Response);
    Log.whenJson(LOGGER, " DistroX instance id based repair response: ", stackV4Response);
    return testDto;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXRepairV1Request(com.sequenceiq.distrox.api.v1.distrox.model.DistroXRepairV1Request) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Example 18 with StackV4Response

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

the class DistroXScaleStopInstancesAction method action.

@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
    Log.when(LOGGER, String.format(" Stopping instances [%s] for distrox '%s' Compute scaling... ", testDto.getInstanceIdsForAction(), testDto.getName()));
    Log.whenJson(LOGGER, " Distrox Compute scale stop instances request: ", testDto.getRequest());
    testDto.setFlow("scale stop", client.getDefaultClient().autoscaleEndpoint().stopInstancesForClusterName(testDto.getName(), testDto.getInstanceIdsForAction(), false, ScalingStrategy.STOPSTART));
    StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), new HashSet<>(Arrays.asList("hardware_info", "events")));
    testDto.setResponse(stackV4Response);
    Log.whenJson(LOGGER, " Distrox Compute scale stop instances response: ", stackV4Response);
    LOGGER.info(String.format("Hardware info for distrox '%s' after stop instances for Compute scale: %s", testDto.getName(), stackV4Response.getHardwareInfoGroups()));
    return testDto;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)

Example 19 with StackV4Response

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

the class DistroXStartAction method action.

@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
    Log.when(LOGGER, format(" Starting Distrox: %s ", testDto.getName()));
    Log.whenJson(LOGGER, " Distrox start request: ", testDto.getRequest());
    FlowIdentifier flowIdentifier = client.getDefaultClient().distroXV1Endpoint().putStartByName(testDto.getName());
    testDto.setFlow("DistroX start", flowIdentifier);
    StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), Collections.emptySet());
    testDto.setResponse(stackV4Response);
    Log.whenJson(LOGGER, " Distrox start response: ", stackV4Response);
    return testDto;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Example 20 with StackV4Response

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

the class CheckVariant method action.

@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
    Log.when(LOGGER, " Checking the stack variant, expected: " + variant);
    StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), Collections.emptySet());
    if (!stackV4Response.getVariant().equals(variant)) {
        throw new TestFailException("Variants are mismatched: expected: " + variant + ", got: " + stackV4Response.getVariant());
    }
    Log.when(LOGGER, " Stack variant checked and matched");
    return testDto;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Aggregations

StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)101 Test (org.junit.jupiter.api.Test)26 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)22 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)19 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)14 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)13 Test (org.junit.Test)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)8 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)7 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)7 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)7 ArrayList (java.util.ArrayList)7 Test (org.testng.annotations.Test)7 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)6 TagsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response)6 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)6 TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)6 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)6