use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DistroXStopStartTest method testCreateDistroXWithEphemeralTemporaryStorage.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak", when = "two valid DistroX create requests are sent one with ephemeral temporary storage and one without it", then = "clusters are created, device mount point are checked, and after stopping and starting the clusters ephemeral store handling checked again")
public void testCreateDistroXWithEphemeralTemporaryStorage(TestContext testContext) {
String username = testContext.getActingUserCrn().getResource();
String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
testContext.given("non_eph_dx", DistroXTestDto.class).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().build()).when(distroXTestClient.create(), RunningParameter.key("non_eph_dx")).given("eph_dx", DistroXTestDto.class).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withStorageOptimizedInstancetype().build()).when(distroXTestClient.create(), RunningParameter.key("eph_dx")).given("non_eph_dx", DistroXTestDto.class).await(STACK_AVAILABLE, RunningParameter.key("non_eph_dx")).then((tc, testDto, client) -> verifyEphemeralVolumesShouldNotBeConfiguredInHdfs(tc, sanitizedUserName, testDto)).when(distroXTestClient.stop(), RunningParameter.key("non_eph_dx")).await(STACK_STOPPED, RunningParameter.key("non_eph_dx")).when(distroXTestClient.start(), RunningParameter.key("non_eph_dx")).await(STACK_AVAILABLE, RunningParameter.key("non_eph_dx")).then((tc, testDto, client) -> verifyEphemeralVolumesShouldNotBeConfiguredInHdfs(tc, sanitizedUserName, testDto)).given("eph_dx", DistroXTestDto.class).await(STACK_AVAILABLE, RunningParameter.key("eph_dx")).then(this::verifyMountedDisks).then((tc, testDto, client) -> verifyEphemeralVolumesShouldNotBeConfiguredInHdfs(tc, sanitizedUserName, testDto)).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroups(testDto, sanitizedUserName, MOCK_UMS_PASSWORD)).when(distroXTestClient.stop(), RunningParameter.key("eph_dx")).await(STACK_STOPPED, RunningParameter.key("eph_dx")).when(distroXTestClient.start(), RunningParameter.key("eph_dx")).await(STACK_AVAILABLE, RunningParameter.key("eph_dx")).then(this::verifyMountedDisks).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroups(testDto, sanitizedUserName, MOCK_UMS_PASSWORD)).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class ImageCatalogListFilteringTest method testImageCatalogListFiltering.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are image catalogs", when = "users share with each other", then = "they see the other's image catalog in the list")
public void testImageCatalogListFiltering(TestContext testContext) {
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
ImageCatalogTestDto imageCatalogA = resourceCreator.createDefaultImageCatalog(testContext);
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
ImageCatalogTestDto imageCatalogB = resourceCreator.createNewImageCatalog(testContext);
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, imageCatalogA.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, imageCatalogB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, imageCatalogA.getName(), imageCatalogB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, imageCatalogB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, imageCatalogA.getName());
testContext.given(UmsTestDto.class).assignTarget(ImageCatalogTestDto.class.getSimpleName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
testContext.given(UmsTestDto.class).assignTarget(imageCatalogB.getName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, imageCatalogA.getName(), imageCatalogB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, imageCatalogA.getName(), imageCatalogB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, imageCatalogA.getName(), imageCatalogB.getName());
useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DistroXEncryptedVolumeTest method testCreateDistroXWithEncryptedVolumesInSingleRG.
@Test(dataProvider = TEST_CONTEXT, groups = { "azure_singlerg" })
@UseSpotInstances
@Description(given = "there is a valid Azure credential and a new resource group", when = "environment with freeIpa should be created in the resource group with encrypted volume", and = "SDX then distroX also with encrypted volumes should be created for environment", then = "freeIpa, sdx and distroX volumes should be encrypted with the provided key")
public void testCreateDistroXWithEncryptedVolumesInSingleRG(TestContext testContext) {
DistroXDatabaseRequest distroXDatabaseRequest = new DistroXDatabaseRequest();
List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withDiskEncryption().build();
distroXDatabaseRequest.setAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA);
createResourceGroupForEnvironment(testContext);
testContext.given(EnvironmentNetworkTestDto.class).withServiceEndpoints().given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(EnvironmentTestDto.class).withNetwork().withResourceGroup(ResourceGroupTest.AZURE_RESOURCE_GROUP_USAGE_SINGLE, resourceGroupForTest).withResourceEncryption().withTelemetry("telemetry").withTunnel(Tunnel.CLUSTER_PROXY).withCreateFreeIpa(Boolean.FALSE).when(environmentTestClient.create()).then((context, dto, client) -> {
context.getCloudProviderAssertion().assertServiceEndpoint(dto);
return dto;
}).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).withEnvironment().withTelemetry("telemetry").withCatalog(commonCloudProperties().getImageValidation().getFreeIpaImageCatalog(), commonCloudProperties().getImageValidation().getFreeIpaImageUuid()).when(freeIpaTestClient.create()).await(Status.AVAILABLE).awaitForHealthyInstances().given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.getLastSyncOperationStatus()).await(OperationState.COMPLETED).given(EnvironmentTestDto.class).when(environmentTestClient.describe()).then(this::verifyEnvironmentResponseDiskEncryptionKey).given(FreeIpaTestDto.class).then(this::verifyFreeIpaVolumeEncryptionKey).given(SdxTestDto.class).withCloudStorage().when(sdxTestClient.create()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::verifySdxVolumeEncryptionKey).given(DistroXTestDto.class).withInstanceGroupsEntity(distroXInstanceGroupTestDtos).withExternalDatabase(distroXDatabaseRequest).when(distroXTestClient.create()).await(STACK_AVAILABLE).awaitForHealthyInstances().then(this::verifyDistroxVolumeEncryptionKey).then(this::verifyAwsEnaDriver).then(new AwsAvailabilityZoneAssertion()).then(validateTemplateContainsExternalDatabaseHostname()).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DistroXRepairTests method testDistroXMasterRepairWithTerminatedEC2Instances.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and DistroX cluster in available state", when = "recovery called on the MASTER host group of DistroX cluster, where the EC2 instance had been terminated", then = "DistroX recovery should be successful, the cluster should be up and running")
public void testDistroXMasterRepairWithTerminatedEC2Instances(TestContext testContext) {
String distrox = resourcePropertyProvider().getName();
List<String> actualVolumeIds = new ArrayList<>();
List<String> expectedVolumeIds = new ArrayList<>();
testContext.given(distrox, DistroXTestDto.class).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().when(distroXTestClient.create(), key(distrox)).await(STACK_AVAILABLE).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<String> instancesToDelete = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
expectedVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instancesToDelete));
cloudFunctionality.deleteInstances(testDto.getName(), instancesToDelete);
return testDto;
}).awaitForHostGroup(MASTER.getName(), InstanceStatus.DELETED_ON_PROVIDER_SIDE).when(distroXTestClient.repair(MASTER), key(distrox)).await(STACK_AVAILABLE, key(distrox)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<String> instanceIds = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
actualVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instanceIds));
return testDto;
}).then((tc, testDto, client) -> VolumeUtils.compareVolumeIdsAfterRepair(testDto, actualVolumeIds, expectedVolumeIds)).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DistroXResilientScaleTests method testPercentageResilientScaleDistrox.
@Test(dataProvider = TEST_CONTEXT, description = "Resilient Scaling: " + "UseCase4: " + "- Start upscale on running cluster with percentage option with at least option " + "- Provider only gives back above threshold " + "- Upscale should complete ")
@Description(given = "there is a running default Distrox cluster", when = "cluster has been scaled up at least 90% of the required node count", and = "cluster has been scaled up again while removing 10% of the instance from the scaled host group", then = "cluster can be resiliently scaled up at least the required node count threshold")
public void testPercentageResilientScaleDistrox(TestContext testContext, ITestContext iTestContext) {
DistroXScaleTestParameters params = new DistroXScaleTestParameters(iTestContext.getCurrentXmlTest().getAllParameters());
testContext.given(DistroXTestDto.class).when(distroXTestClient.scale(params.getHostGroup(), params.getScaleUpTarget(), params.getAdjustmentType(), params.getThreshold())).awaitForFlow().then(new DistroxScaleThresholdAssertions(params.getHostGroup(), params.getScaleUpTarget(), params.getThreshold())).when(distroXTestClient.scale(params.getHostGroup(), params.getScaleDownTarget())).awaitForFlow().when(distroXTestClient.scale(params.getHostGroup(), params.getScaleUpTarget(), params.getAdjustmentType(), params.getThreshold())).then((tc, testDto, client) -> removeInstanceWhileScalingGroup(tc, testDto, client, params)).awaitForFlow().when(distroXTestClient.get()).then(new DistroxScaleThresholdAssertions(params.getHostGroup(), params.getScaleUpTarget(), params.getThreshold())).validate();
}
Aggregations