use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DistroXUpgradeTests method testDistroXEphemeralUpgrade.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and DistroX cluster in available state", when = "upgrade called on the DistroX cluster", then = "DistroX upgrade should be successful, the cluster should be up and running")
public void testDistroXEphemeralUpgrade(TestContext testContext) {
String sdxName = resourcePropertyProvider().getName();
String distroXName = resourcePropertyProvider().getName();
String currentRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeCurrentVersion();
String targetRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeTargetVersion();
String username = testContext.getActingUserCrn().getResource();
String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
testContext.given(sdxName, SdxTestDto.class).withCloudStorage().withRuntimeVersion(currentRuntimeVersion).when(sdxTestClient.create(), key(sdxName)).await(SdxClusterStatusResponse.RUNNING, key(sdxName)).awaitForHealthyInstances().validate();
testContext.given(distroXName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion)).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withStorageOptimizedInstancetype().build()).when(distroXTestClient.create(), key(distroXName)).await(STACK_AVAILABLE).awaitForHealthyInstances().validate();
testContext.given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion).given(distroXName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroXName)).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<InstanceGroupV4Response> instanceGroups = testDto.getResponse().getInstanceGroups();
cloudFunctionality.checkMountedDisks(instanceGroups, List.of(HostGroupType.WORKER.getName()));
return testDto;
}).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroupsDirect(testDto, sanitizedUserName, MOCK_UMS_PASSWORD)).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class RecipeListFilteringTest method testRecipeListFiltering.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are recipes", when = "users share with each other", then = "they see the other's recipe in the list")
public void testRecipeListFiltering(TestContext testContext) {
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
RecipeTestDto recipeA = resourceCreator.createDefaultRecipe(testContext);
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
RecipeTestDto recipeB = resourceCreator.createNewRecipe(testContext);
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeA.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, recipeA.getName(), recipeB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeA.getName());
testContext.given(UmsTestDto.class).assignTarget(RecipeTestDto.class.getSimpleName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeA.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeA.getName(), recipeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, recipeA.getName(), recipeB.getName());
testContext.given(UmsTestDto.class).assignTarget(recipeB.getName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeA.getName(), recipeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeA.getName(), recipeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, recipeA.getName(), recipeB.getName());
useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DistroXEncryptedVolumeTest method testCreateDistroXWithEncryptedVolumes.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a valid credential for the selected provider", when = "new environment and freeIpa with encrypted volume should be created", and = "SDX then distroX with encrypted volumes also should be created for environment", then = "freeIpa, sdx and distroX volumes should be encrypted with the provided key")
public void testCreateDistroXWithEncryptedVolumes(TestContext testContext) {
DistroXDatabaseRequest distroXDatabaseRequest = new DistroXDatabaseRequest();
List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withDiskEncryption().build();
distroXDatabaseRequest.setAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA);
testContext.given(EnvironmentNetworkTestDto.class).given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(EnvironmentTestDto.class).withNetwork().withResourceEncryption().withTelemetry("telemetry").withTunnel(Tunnel.CLUSTER_PROXY).withCreateFreeIpa(Boolean.FALSE).when(environmentTestClient.create()).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 DistroXImagesTests method testDistroXWithBaseImageCanBeCreatedSuccessfully.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak", when = "a valid DistroX create request is sent (latest Base Image)", then = "DistroX should be available and deletable")
public void testDistroXWithBaseImageCanBeCreatedSuccessfully(TestContext testContext) {
String imageSettings = resourcePropertyProvider().getName();
String imageCatalog = resourcePropertyProvider().getName();
String distrox = resourcePropertyProvider().getName();
AtomicReference<String> selectedImageID = new AtomicReference<>();
CloudProvider cloudProvider = testContext.getCloudProvider();
testContext.given(imageCatalog, ImageCatalogTestDto.class).when((tc, dto, client) -> {
selectedImageID.set(cloudProvider.getLatestBaseImageID(tc, dto, client));
return dto;
}).given(imageSettings, DistroXImageTestDto.class).withImageCatalog(cloudProvider.getImageCatalogName()).withImageId(selectedImageID.get()).given(distrox, DistroXTestDto.class).withImageSettings(imageSettings).when(distroXTestClient.create(), key(distrox)).await(STACK_AVAILABLE).awaitForHealthyInstances().then((tc, dto, client) -> {
Log.log(LOGGER, format(" Image Catalog Name: %s ", dto.getResponse().getImage().getCatalogName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", dto.getResponse().getImage().getCatalogUrl()));
Log.log(LOGGER, format(" Image ID: %s ", dto.getResponse().getImage().getId()));
if (!dto.getResponse().getImage().getId().equals(selectedImageID.get())) {
throw new TestFailException(" The selected image ID is: " + dto.getResponse().getImage().getId() + " instead of: " + selectedImageID.get());
}
return dto;
}).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class DataLakeListFilteringTest method testDataLakeListFiltering.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are datalakes", when = "users share with each other", then = "they see the other's datalake in the list")
public void testDataLakeListFiltering(TestContext testContext) {
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
resourceCreator.createDefaultCredential(testContext);
resourceCreator.createDefaultEnvironment(testContext);
SdxInternalTestDto dataLakeA = resourceCreator.createDefaultDataLake(testContext);
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
CredentialTestDto credential = resourceCreator.createNewCredential(testContext);
EnvironmentTestDto environmentB = resourceCreator.createNewEnvironment(testContext, credential);
SdxInternalTestDto dataLakeB = resourceCreator.createNewDataLake(testContext, environmentB);
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, dataLakeA.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, dataLakeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, dataLakeA.getName(), dataLakeB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, dataLakeB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, dataLakeA.getName());
testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
testContext.given(UmsTestDto.class).assignTarget(environmentB.getName()).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, dataLakeA.getName(), dataLakeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, dataLakeA.getName(), dataLakeB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, dataLakeA.getName(), dataLakeB.getName());
useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Aggregations