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);
}
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();
}
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());
}
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();
}
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();
}
Aggregations