Search in sources :

Example 61 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class DataHubCreateInternalApiTest method createInternalBlueprintsAndRecipesAndDataHubFromThem.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "internal recipes, blueprints", when = "creates datahub through internal api", then = "initiator user can do main operations on it")
public void createInternalBlueprintsAndRecipesAndDataHubFromThem(TestContext testContext) {
    String accountId = Crn.safeFromString(cloudbreakActor.useRealUmsUser(AuthUserKeys.USER_ENV_CREATOR_A).getCrn()).getAccountId();
    resourceCreator.createDefaultImageCatalog(testContext);
    RecipeTestDto recipe = resourceCreator.createDefaultRecipeInternal(testContext, accountId);
    BlueprintTestDto blueprint = resourceCreator.createDefaultBlueprintInternal(testContext, accountId, commonClusterManagerProperties().getRuntimeVersion());
    recipe.when(recipeTestClient.getV4Internal()).validate();
    blueprint.when(blueprintTestClient.getV4Internal()).validate();
    resourceCreator.createDefaultCredential(testContext);
    resourceCreator.createDefaultEnvironment(testContext);
    resourceCreator.createDefaultFreeIpa(testContext);
    resourceCreator.createDefaultDataLake(testContext);
    DistroXTestDto distroXTestDto = testContext.given(DistroXNetworkTestDto.class).given(DistroXImageTestDto.class).withImageCatalog().withImageId(IMAGE_CATALOG_ID).given(DistroXClouderaManagerTestDto.class).given(DistroXClusterTestDto.class).withBlueprintName(blueprint.getName()).withClouderaManager().given(DistroXTestDto.class).withRecipe(recipe.getName()).withInitiatorUserCrn(cloudbreakActor.useRealUmsUser(AuthUserKeys.USER_ENV_CREATOR_A).getCrn());
    distroXTestDto.withCluster().withImageSettings(testContext.given(DistroXImageTestDto.class)).withNetwork(testContext.given(DistroXNetworkTestDto.class));
    resourceCreator.createInternalAndWaitAs(distroXTestDto, Optional.of(AuthUserKeys.USER_ACCOUNT_ADMIN));
    RunningParameter envCreatorA = user(AuthUserKeys.USER_ENV_CREATOR_A);
    RunningParameter envCreatorB = user(AuthUserKeys.USER_ENV_CREATOR_B);
    RunningParameter accountAdmin = user(AuthUserKeys.USER_ACCOUNT_ADMIN);
    distroXTestDto.when(distroXTestClient.get(), envCreatorA).validate();
    distroXTestDto.when(distroXTestClient.stop(), envCreatorA).await(STACK_STOPPED, accountAdmin).validate();
    distroXTestDto.when(distroXTestClient.start(), envCreatorA).await(STACK_AVAILABLE, accountAdmin).validate();
    testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    distroXTestDto.when(distroXTestClient.get(), envCreatorB).validate();
    distroXTestDto.when(distroXTestClient.delete(), envCreatorA).await(STACK_DELETED, accountAdmin).validate();
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto) RunningParameter(com.sequenceiq.it.cloudbreak.context.RunningParameter) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) DistroXNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXNetworkTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Example 62 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class UserSyncTest method testUserSyncDuration.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running default environment with no freeIpa", when = "freeIpa should be successfully created", then = "all users should be synced successfully with no failure " + "and finished in given (5) minutes")
public void testUserSyncDuration(TestContext testContext) {
    String freeIpa = resourcePropertyProvider().getName();
    testContext.given(freeIpa, FreeIpaTestDto.class).when(freeIpaTestClient.create(), key(freeIpa)).await(Status.AVAILABLE).given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.getLastSyncOperationStatus()).await(OperationState.COMPLETED).then(new FreeIpaUserSyncDurationLessThan(5)).then(new FreeIpaUserSyncDoneWithNoFailures()).validate();
}
Also used : FreeIpaUserSyncDoneWithNoFailures(com.sequenceiq.it.cloudbreak.assertion.freeipa.FreeIpaUserSyncDoneWithNoFailures) FreeIpaUserSyncTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaUserSyncTestDto) FreeIpaUserSyncDurationLessThan(com.sequenceiq.it.cloudbreak.assertion.freeipa.FreeIpaUserSyncDurationLessThan) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)

Example 63 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class DistroXScaleTest method testCreateAndScaleDistroX.

@Test(dataProvider = TEST_CONTEXT, description = "Resilient Scaling: " + "UseCase1: " + "- Start upscale on running cluster " + "- Delete a non CM server host from provider other hostgroup during upscale " + "- Upscale should complete ")
@Description(given = "there is a running default Distrox cluster", when = "deleted a Compute instance while cluster was upscaling (by Worker nodes)", then = "cluster can be resiliently scaled up then down with higher node count")
public void testCreateAndScaleDistroX(TestContext testContext, ITestContext iTestContext) {
    DistroXScaleTestParameters params = new DistroXScaleTestParameters(iTestContext.getCurrentXmlTest().getAllParameters());
    if (params.getTimes() < 1) {
        throw new TestFailException("Test should execute at least 1 round of scaling");
    }
    StringBuilder instanceToStopId = new StringBuilder();
    testContext.given(DistroXTestDto.class).then((tc, testDto, client) -> {
        CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
        Optional<String> anInstanceToStop = distroxUtil.getInstanceIds(testDto, client, params.getHostGroup()).stream().findFirst();
        if (anInstanceToStop.isEmpty()) {
            throw new TestFailException(String.format("At least 1 instance needed from group %s to test stop it and test targeted upscale.", params.getIrrelevantHostGroup()));
        }
        cloudFunctionality.stopInstances(testDto.getName(), List.of(anInstanceToStop.get()));
        instanceToStopId.append(anInstanceToStop.get());
        return testDto;
    }).await(STACK_NODE_FAILURE).when(distroXTestClient.scale(params.getHostGroup(), params.getScaleUpTarget())).then((tc, testDto, client) -> {
        CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
        Optional<String> anInstanceToDelete = distroxUtil.getInstanceIds(testDto, client, params.getIrrelevantHostGroup()).stream().findFirst();
        if (anInstanceToDelete.isEmpty()) {
            throw new TestFailException(String.format("At least 1 instance needed from group %s to test delete it and test targeted upscale.", params.getIrrelevantHostGroup()));
        }
        cloudFunctionality.deleteInstances(testDto.getName(), List.of(anInstanceToDelete.get()));
        testDto.setInstanceIdsForActions(List.of(anInstanceToDelete.get()));
        return testDto;
    }).awaitForFlow().awaitForActionedInstances(DELETED_ON_PROVIDER_SIDE).then((tc, testDto, client) -> {
        testDto.setInstanceIdsForActions(mergeInstanceIdList(testDto.getInstanceIdsForAction(), instanceToStopId.toString()));
        return testDto;
    }).when(distroXTestClient.removeInstances()).awaitForFlow().when(distroXTestClient.scale(params.getHostGroup(), params.getScaleDownTarget())).awaitForFlow().validate();
    IntStream.range(1, params.getTimes()).forEach(i -> testContext.given(DistroXTestDto.class).when(distroXTestClient.scale(params.getHostGroup(), params.getScaleUpTarget())).awaitForFlow().when(distroXTestClient.scale(params.getHostGroup(), params.getScaleDownTarget())).awaitForFlow().validate());
}
Also used : IntStream(java.util.stream.IntStream) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ITestContext(org.testng.ITestContext) Test(org.testng.annotations.Test) DELETED_ON_PROVIDER_SIDE(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.DELETED_ON_PROVIDER_SIDE) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) ArrayList(java.util.ArrayList) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) List(java.util.List) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) DistroxUtil(com.sequenceiq.it.cloudbreak.util.DistroxUtil) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) Optional(java.util.Optional) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) Optional(java.util.Optional) CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)

Example 64 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class DistroXStopStartScaleTest method testStopStartScaleDistroX.

/**
 * The "Scaling" via Instance Stop/Start for DataHub ‘compute’ nodes (NodeManagers only) improves scaling performance
 * - at best, 4-6 minutes for a single node.
 *
 * @param testContext   Spring offers ApplicationContextAware interface to provide configuration of the Integration Test ApplicationContext.
 * @param iTestContext  TestNG offers the ITestContext interface to store and share test objects through test execution.
 */
@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running default Distrox cluster", when = "cluster has been scaled successfully by 4 compute nodes", then = "cluster compute nodes can be scaled down then up via stop then start instances at provider")
public void testStopStartScaleDistroX(TestContext testContext, ITestContext iTestContext) {
    AtomicReference<List<String>> instancesToStop = new AtomicReference<>();
    DistroXScaleTestParameters params = new DistroXScaleTestParameters(iTestContext.getCurrentXmlTest().getAllParameters());
    if (params.getTimes() < 1) {
        throw new TestFailException("Test should execute at least 1 round of scaling");
    }
    testContext.given(DistroXTestDto.class).when(distroXTestClient.scale(params.getHostGroup(), params.getScaleUpTarget())).awaitForFlow().then((tc, testDto, client) -> {
        instancesToStop.set(distroxUtil.getInstanceIds(testDto, client, params.getHostGroup()).stream().limit(params.getScaleDownTarget()).collect(Collectors.toList()));
        testDto.setInstanceIdsForActions(instancesToStop.get());
        return testDto;
    }).when(distroXTestClient.scaleStopInstances()).awaitForFlow().then(new DistroxStopStartScaleDurationAssertions(6, false)).when(distroXTestClient.scaleStartInstances(params.getHostGroup(), params.getScaleUpTarget())).awaitForFlow().when(distroXTestClient.get()).then(new DistroxStopStartScaleDurationAssertions(6, true));
    IntStream.range(1, params.getTimes()).forEach(i -> {
        testContext.given(DistroXTestDto.class).when(distroXTestClient.scaleStopInstances()).awaitForFlow().then(new DistroxStopStartScaleDurationAssertions(6, false)).when(distroXTestClient.scaleStartInstances(params.getHostGroup(), params.getScaleUpTarget())).awaitForFlow().when(distroXTestClient.get()).then(new DistroxStopStartScaleDurationAssertions(6, true));
    });
    testContext.given(DistroXTestDto.class).validate();
}
Also used : IntStream(java.util.stream.IntStream) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ITestContext(org.testng.ITestContext) DistroxStopStartScaleDurationAssertions(com.sequenceiq.it.cloudbreak.assertion.distrox.DistroxStopStartScaleDurationAssertions) Test(org.testng.annotations.Test) AtomicReference(java.util.concurrent.atomic.AtomicReference) Collectors(java.util.stream.Collectors) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) List(java.util.List) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) DistroxUtil(com.sequenceiq.it.cloudbreak.util.DistroxUtil) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) List(java.util.List) AtomicReference(java.util.concurrent.atomic.AtomicReference) DistroxStopStartScaleDurationAssertions(com.sequenceiq.it.cloudbreak.assertion.distrox.DistroxStopStartScaleDurationAssertions) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)

Example 65 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class DistroXUpgradeTests method testDistroXUpgrades.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and two DistroX clusters in " + "available state, one cluster created with deafult catalog and one cluster created with production catalog", when = "upgrade called on both DistroX clusters", then = "Both DistroX upgrade should be successful," + " the clusters should be up and running")
public void testDistroXUpgrades(TestContext testContext) {
    String imageSettings = resourcePropertyProvider().getName();
    String currentRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeCurrentVersion();
    String targetRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeTargetVersion();
    String currentRuntimeVersion3rdParty = commonClusterManagerProperties.getUpgrade().getDistroXUpgrade3rdPartyCurrentVersion();
    String targetRuntimeVersion3rdParty = commonClusterManagerProperties.getUpgrade().getDistroXUpgrade3rdPartyTargetVersion();
    String sdxName = resourcePropertyProvider().getName();
    String distroXName = resourcePropertyProvider().getName();
    String distroX3rdPartyName = resourcePropertyProvider().getName();
    String thirdPartyCatalogName = resourcePropertyProvider().getName();
    AtomicReference<String> uuid = new AtomicReference<>();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(sdxName, SdxTestDto.class).withRuntimeVersion(currentRuntimeVersion).withCloudStorage(getCloudStorageRequest(testContext)).withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdxName)).await(SdxClusterStatusResponse.RUNNING, key(sdxName)).awaitForHealthyInstances().validate();
    testContext.given(distroXName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion)).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().when(distroXTestClient.create(), key(distroXName)).validate();
    createImageValidationSourceCatalog(testContext, commonClusterManagerProperties.getUpgrade().getImageCatalogUrl3rdParty(), thirdPartyCatalogName);
    uuid.set(getUuid(testContext, thirdPartyCatalogName, currentRuntimeVersion3rdParty));
    testContext.given(imageSettings, DistroXImageTestDto.class).withImageCatalog(thirdPartyCatalogName).withImageId(uuid.get()).given(distroX3rdPartyName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion3rdParty)).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().withImageSettings(imageSettings).when(distroXTestClient.create(), key(distroX3rdPartyName)).await(STACK_AVAILABLE, key(distroX3rdPartyName)).awaitForHealthyInstances().then((tc, testDto, client) -> checkImageId(testDto, uuid.get())).given(distroXName, DistroXTestDto.class).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).validate();
    testContext.given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion).given(distroXName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroXName)).given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion3rdParty).given(distroX3rdPartyName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroX3rdPartyName)).await(STACK_AVAILABLE, key(distroX3rdPartyName)).awaitForHealthyInstances().given(distroXName, DistroXTestDto.class).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).validate();
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) AtomicReference(java.util.concurrent.atomic.AtomicReference) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) CommonClusterManagerProperties(com.sequenceiq.it.cloudbreak.cloud.v4.CommonClusterManagerProperties) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) DistroXUpgradeTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXUpgradeTestDto) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) AwsAvailabilityZoneAssertion(com.sequenceiq.it.cloudbreak.assertion.distrox.AwsAvailabilityZoneAssertion) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) AwsAvailabilityZoneAssertion(com.sequenceiq.it.cloudbreak.assertion.distrox.AwsAvailabilityZoneAssertion) AtomicReference(java.util.concurrent.atomic.AtomicReference) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Aggregations

Description (com.sequenceiq.it.cloudbreak.context.Description)72 Test (org.testng.annotations.Test)71 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)30 Inject (javax.inject.Inject)30 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)29 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)24 AbstractE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)22 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)19 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)19 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)17 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)17 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)16 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)16 SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)15 EnvironmentNetworkTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto)14 List (java.util.List)14 ImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)13 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)13 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)13 DistroXTestClient (com.sequenceiq.it.cloudbreak.client.DistroXTestClient)12