Search in sources :

Example 1 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelActivationListenerTask method doStatusCheck.

@Override
protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject) throws ApiException {
    ApiClient apiClient = pollerObject.getApiClient();
    Stack stack = pollerObject.getStack();
    ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName());
    List<ApiParcel> notActivated = getNotActivatedOrMissingParcels(parcels);
    if (notActivated.isEmpty()) {
        LOGGER.debug("Parcels are activated.");
        return true;
    } else {
        LOGGER.debug("Some parcels are not yet activated: [{}].", getJoinedParcelStages(notActivated));
        return false;
    }
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ApiParcelList(com.cloudera.api.swagger.model.ApiParcelList) ApiClient(com.cloudera.api.swagger.client.ApiClient) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 2 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelStatusListenerTask method doStatusCheck.

@Override
protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject) throws ApiException {
    ApiClient apiClient = pollerObject.getApiClient();
    Stack stack = pollerObject.getStack();
    ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName());
    List<ApiParcel> notInProperStateParcels = getNotInProperStateParcels(parcels);
    if (notInProperStateParcels.isEmpty()) {
        LOGGER.debug("Parcels are in the proper statuses: {}", parcelStatus);
        return true;
    } else {
        LOGGER.debug("Some parcels are not yet in the proper status: [{}].", getJoinedParcelStages(notInProperStateParcels));
        return false;
    }
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ApiParcelList(com.cloudera.api.swagger.model.ApiParcelList) ApiClient(com.cloudera.api.swagger.client.ApiClient) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 3 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class RecipeClusterTest method testWhenClusterGetUpScaledThenPostClusterInstallRecipeShouldBeExecuted.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a created cluster with post ambari install recipe", when = "upscaling cluster", then = "the post recipe should run on the new nodes as well")
public void testWhenClusterGetUpScaledThenPostClusterInstallRecipeShouldBeExecuted(MockedTestContext testContext) {
    ApiParcel parcel = parcelGeneratorUtil.getActivatedCDHParcel();
    String clusterName = resourcePropertyProvider.getName();
    parcelMockActivatorUtil.mockActivateWithDefaultParcels(testContext, clusterName, parcel);
    String recipeName = resourcePropertyProvider().getName();
    testContext.given(RecipeTestDto.class).withName(recipeName).withContent(RECIPE_CONTENT).withRecipeType(POST_CLUSTER_INSTALL).when(recipeTestClient.createV4()).given(INSTANCE_GROUP_ID, InstanceGroupTestDto.class).withHostGroup(HostGroupType.WORKER).withNodeCount(NODE_COUNT).withRecipes(recipeName).given("computeIg", InstanceGroupTestDto.class).withHostGroup(HostGroupType.COMPUTE).withNodeCount(NODE_COUNT).withRecipes(recipeName).given("cmpkey", ClouderaManagerProductTestDto.class).withParcel("someParcel").withName(parcel.getProduct()).withVersion(parcel.getVersion()).given("cmanager", ClouderaManagerTestDto.class).withClouderaManagerProduct("cmpkey").given("cmpclusterkey", ClusterTestDto.class).withClouderaManager("cmanager").given(StackTestDto.class).withName(clusterName).replaceInstanceGroups(INSTANCE_GROUP_ID).withCluster("cmpclusterkey").when(stackTestClient.createV4()).enableVerification().await(STACK_AVAILABLE).when(StackScalePostAction.valid().withDesiredCount(4)).await(STACK_AVAILABLE, pollingInterval(POLLING_INTERVAL)).mockSalt().run().post().bodyContains(HIGHSTATE, 1).atLeast(1).verify().validate();
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ClouderaManagerProductTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerProductTestDto) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) ClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) TestCaseDescription(com.sequenceiq.it.cloudbreak.context.TestCaseDescription) Test(org.testng.annotations.Test)

Example 4 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class RecipeClusterTest method testWhenRecipeProvidedToHostGroupAndAnotherHostGroupGetUpScaledThenThereIsNoFurtherRecipeExecutionOnTheNewNodeBesideTheDefaultOnes.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a created cluster with post ambari recipe", when = "upscaling cluster on hostgroup which has no post install recipe", then = "the post recipe should not run on the new nodes because those recipe not configured on the upscaled hostgroup")
public void testWhenRecipeProvidedToHostGroupAndAnotherHostGroupGetUpScaledThenThereIsNoFurtherRecipeExecutionOnTheNewNodeBesideTheDefaultOnes(MockedTestContext testContext) {
    ApiParcel parcel = parcelGeneratorUtil.getActivatedCDHParcel();
    String recipeName = resourcePropertyProvider().getName();
    String clusterName = resourcePropertyProvider.getName();
    parcelMockActivatorUtil.mockActivateWithDefaultParcels(testContext, clusterName, parcel);
    testContext.given(RecipeTestDto.class).withName(recipeName).withContent(RECIPE_CONTENT).withRecipeType(POST_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4()).given(INSTANCE_GROUP_ID, InstanceGroupTestDto.class).withHostGroup(HostGroupType.COMPUTE).withNodeCount(NODE_COUNT).withRecipes(recipeName).given("cmpkey", ClouderaManagerProductTestDto.class).withParcel("someParcel").withName(parcel.getProduct()).withVersion(parcel.getVersion()).given("cmanager", ClouderaManagerTestDto.class).withClouderaManagerProduct("cmpkey").given("cmpclusterkey", ClusterTestDto.class).withClouderaManager("cmanager").given(StackTestDto.class).withName(clusterName).replaceInstanceGroups(INSTANCE_GROUP_ID).withCluster("cmpclusterkey").when(stackTestClient.createV4()).enableVerification().await(STACK_AVAILABLE).when(StackScalePostAction.valid().withDesiredCount(4)).await(STACK_AVAILABLE, pollingInterval(POLLING_INTERVAL)).mockSalt().run().post().bodyContains(HIGHSTATE, 1).atLeast(1).verify().validate();
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ClouderaManagerProductTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerProductTestDto) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) ClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) TestCaseDescription(com.sequenceiq.it.cloudbreak.context.TestCaseDescription) Test(org.testng.annotations.Test)

Example 5 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class CMDownscaleWithHttp500ResponsesTest method testDownscale.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a stack with upscale", when = "upscale to 15 it downscale to 6", then = "stack is running")
public void testDownscale(MockedTestContext testContext) {
    ApiParcel parcel = parcelGeneratorUtil.getActivatedCDHParcel();
    String clusterName = resourcePropertyProvider().getName();
    parcelMockActivatorUtil.mockActivateWithDefaultParcels(testContext, clusterName, parcel);
    testContext.given("cmpkey", DistroXClouderaManagerProductTestDto.class).withParcel("someParcel").withName(parcel.getProduct()).withVersion(parcel.getVersion()).given("cmanager", DistroXClouderaManagerTestDto.class).withClouderaManagerProduct("cmpkey").given("cmpclusterkey", DistroXClusterTestDto.class).withClouderaManager("cmanager").given(clusterName, DistroXTestDto.class).withName(clusterName).withCluster("cmpclusterkey").when(distroXTestClient.create(), key(clusterName)).mockCm().profile(PROFILE_RETURN_HTTP_500, 1).await(STACK_AVAILABLE, key(clusterName).withIgnoredStatues(Set.of(Status.UNREACHABLE))).when(distroXTestClient.scale("worker", 15)).await(STACK_AVAILABLE, key(clusterName).withPollingInterval(POLLING_INTERVAL).withIgnoredStatues(Set.of(Status.UNREACHABLE))).when(distroXTestClient.scale("worker", 6)).await(STACK_AVAILABLE, key(clusterName).withPollingInterval(POLLING_INTERVAL).withIgnoredStatues(Set.of(Status.UNREACHABLE))).validate();
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) DistroXClouderaManagerProductTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.clouderamanager.DistroXClouderaManagerProductTestDto) DistroXClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.clouderamanager.DistroXClouderaManagerTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Aggregations

ApiParcel (com.cloudera.api.swagger.model.ApiParcel)20 ApiParcelList (com.cloudera.api.swagger.model.ApiParcelList)9 ApiClient (com.cloudera.api.swagger.client.ApiClient)7 ClouderaManagerCommandPollerObject (com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerCommandPollerObject)6 Test (org.junit.jupiter.api.Test)6 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)5 ParcelResourceApi (com.cloudera.api.swagger.ParcelResourceApi)4 ApiParcelState (com.cloudera.api.swagger.model.ApiParcelState)3 Description (com.sequenceiq.it.cloudbreak.context.Description)3 Test (org.testng.annotations.Test)3 ApiException (com.cloudera.api.swagger.client.ApiException)2 Multimap (com.google.common.collect.Multimap)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)2 ExtendedPollingResult (com.sequenceiq.cloudbreak.polling.ExtendedPollingResult)2 TestCaseDescription (com.sequenceiq.it.cloudbreak.context.TestCaseDescription)2 ClouderaManagerProductTestDto (com.sequenceiq.it.cloudbreak.dto.ClouderaManagerProductTestDto)2 ClouderaManagerTestDto (com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto)2 ClusterTestDto (com.sequenceiq.it.cloudbreak.dto.ClusterTestDto)2 InstanceGroupTestDto (com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto)2 StackTestDto (com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto)2