Search in sources :

Example 1 with POST_CLOUDERA_MANAGER_START

use of com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.requests.RecipeV4Type.POST_CLOUDERA_MANAGER_START in project cloudbreak by hortonworks.

the class InternalSdxRepairWithRecipeTest method testSDXMultiRepairIDBRokerAndMasterWithRecipeFile.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "recovery called on the IDBROKER and MASTER host group, where the EC2 instance had been stopped", then = "SDX recovery should be successful, the cluster should be up and running")
public void testSDXMultiRepairIDBRokerAndMasterWithRecipeFile(TestContext testContext) throws IOException {
    String sdxInternal = resourcePropertyProvider().getName();
    String cluster = resourcePropertyProvider().getName();
    String clouderaManager = resourcePropertyProvider().getName();
    String recipeName = resourcePropertyProvider().getName();
    String stack = resourcePropertyProvider().getName();
    String filePath = "/post-install";
    String fileName = "post-install";
    String masterInstanceGroup = "master";
    String idbrokerInstanceGroup = "idbroker";
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(clouderaManager, ClouderaManagerTestDto.class).given(cluster, ClusterTestDto.class).withBlueprintName(getDefaultSDXBlueprintName()).withValidateBlueprint(Boolean.FALSE).withClouderaManager(clouderaManager).given(RecipeTestDto.class).withName(recipeName).withContent(generateRecipeContent()).withRecipeType(POST_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4()).given(masterInstanceGroup, InstanceGroupTestDto.class).withHostGroup(MASTER).withNodeCount(1).withRecipes(recipeName).given(idbrokerInstanceGroup, InstanceGroupTestDto.class).withHostGroup(IDBROKER).withNodeCount(1).withRecipes(recipeName).given(stack, StackTestDto.class).withCluster(cluster).withInstanceGroups(masterInstanceGroup, idbrokerInstanceGroup).given(sdxInternal, SdxInternalTestDto.class).withCloudStorage(getCloudStorageRequest(testContext)).withDatabase(sdxDatabaseRequest).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, testDto, client) -> {
        return sshJUtil.checkFilesOnHostByNameAndPath(testDto, getInstanceGroups(testDto, client), List.of(MASTER.getName(), IDBROKER.getName()), filePath, fileName, 1, null, null);
    }).then((tc, testDto, client) -> {
        List<String> instanceIdsToStop = sdxUtil.getInstanceIds(testDto, client, MASTER.getName());
        instanceIdsToStop.addAll(sdxUtil.getInstanceIds(testDto, client, IDBROKER.getName()));
        getCloudFunctionality(tc).stopInstances(testDto.getName(), instanceIdsToStop);
        return testDto;
    }).awaitForStoppedInstances().when(sdxTestClient.repairInternal(MASTER.getName(), IDBROKER.getName()), key(sdxInternal)).await(SdxClusterStatusResponse.REPAIR_IN_PROGRESS, key(sdxInternal).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).awaitForHealthyInstances().then((tc, testDto, client) -> {
        return sshJUtil.checkFilesOnHostByNameAndPath(testDto, getInstanceGroups(testDto, client), List.of(MASTER.getName(), IDBROKER.getName()), filePath, fileName, 1, null, null);
    }).validate();
}
Also used : ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) POST_CLOUDERA_MANAGER_START(com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.requests.RecipeV4Type.POST_CLOUDERA_MANAGER_START) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Base64(org.apache.commons.codec.binary.Base64) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) ResourceUtil(com.sequenceiq.it.util.ResourceUtil) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) SdxUtil(com.sequenceiq.it.cloudbreak.util.SdxUtil) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto) MASTER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER) IDBROKER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER) IOException(java.io.IOException) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) StackTestClient(com.sequenceiq.it.cloudbreak.client.StackTestClient) SshJUtil(com.sequenceiq.it.cloudbreak.util.ssh.SshJUtil) List(java.util.List) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) RecipeTestClient(com.sequenceiq.it.cloudbreak.client.RecipeTestClient) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) List(java.util.List) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Aggregations

POST_CLOUDERA_MANAGER_START (com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.requests.RecipeV4Type.POST_CLOUDERA_MANAGER_START)1 RecipeTestClient (com.sequenceiq.it.cloudbreak.client.RecipeTestClient)1 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)1 StackTestClient (com.sequenceiq.it.cloudbreak.client.StackTestClient)1 IDBROKER (com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER)1 MASTER (com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER)1 Description (com.sequenceiq.it.cloudbreak.context.Description)1 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)1 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)1 ClouderaManagerTestDto (com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto)1 ClusterTestDto (com.sequenceiq.it.cloudbreak.dto.ClusterTestDto)1 InstanceGroupTestDto (com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto)1 RecipeTestDto (com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto)1 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)1 StackTestDto (com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto)1 SdxUtil (com.sequenceiq.it.cloudbreak.util.SdxUtil)1 SshJUtil (com.sequenceiq.it.cloudbreak.util.ssh.SshJUtil)1 ResourceUtil (com.sequenceiq.it.util.ResourceUtil)1 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)1 SdxDatabaseAvailabilityType (com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType)1