use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class EnvironmentListFilteringTest method testEnvironmentListFiltering.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are environments", when = "users share with each other", then = "they see the other's environment in the list")
public void testEnvironmentListFiltering(TestContext testContext) {
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
resourceCreator.createDefaultCredential(testContext);
EnvironmentTestDto environmentA = resourceCreator.createDefaultEnvironment(testContext);
useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
CredentialTestDto credential = resourceCreator.createNewCredential(testContext);
EnvironmentTestDto environmentB = resourceCreator.createNewEnvironment(testContext, credential);
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentA.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, environmentA.getName(), environmentB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentB.getName());
assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentA.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, environmentA.getName(), environmentB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentA.getName(), environmentB.getName());
assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, environmentA.getName(), environmentB.getName());
useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class MockSdxUpgradeTests method testSdxUpgradeSuccessfulWhenExternalDatabaseIsUsed.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running CloudSdxInternalTestDtobreak", when = "start an sdx cluster with external database", then = "Upgrade option should be presented")
public void testSdxUpgradeSuccessfulWhenExternalDatabaseIsUsed(MockedTestContext testContext) {
String upgradeImageCatalogName = resourcePropertyProvider().getName();
createImageCatalogForOsUpgrade(testContext, upgradeImageCatalogName);
String sdxInternal = resourcePropertyProvider().getName();
String stack = resourcePropertyProvider().getName();
String clouderaManager = "cm";
String cluster = "cmcluster";
String imageSettings = "imageSettingsUpgrade";
String networkKey = "someOtherNetwork";
String clusterCrn = TestCrnGenerator.getDatalakeCrn(UUID.randomUUID().toString(), "cloudera");
testContext.given(networkKey, EnvironmentNetworkTestDto.class).withMock(new EnvironmentNetworkMockParams()).given(EnvironmentTestDto.class).withNetwork(networkKey).withCreateFreeIpa(Boolean.TRUE).withName(resourcePropertyProvider().getEnvironmentName()).when(getEnvironmentTestClient().create()).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).when(freeIpaTestClient.create()).await(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.AVAILABLE).given(RedbeamsDatabaseServerTestDto.class).withEnvironmentCrn(testContext.get(EnvironmentTestDto.class).getResponse().getCrn()).withClusterCrn(clusterCrn).when(redbeamsDatabaseServerTestClient.createV4()).await(Status.AVAILABLE).given(clouderaManager, ClouderaManagerTestDto.class).given(cluster, ClusterTestDto.class).withClouderaManager(clouderaManager).withExternalDatabaseCrn().given(imageSettings, ImageSettingsTestDto.class).withImageId("aaa778fc-7f17-4535-9021-515351df3691").withImageCatalog(upgradeImageCatalogName).given(stack, StackTestDto.class).withCluster(cluster).withImageSettings(imageSettings).given(sdxInternal, SdxInternalTestDto.class).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).then(SdxUpgradeTestAssertion.validateSuccessfulUpgrade()).validate();
}
Aggregations