Search in sources :

Example 71 with Description

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);
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) CredentialTestDto(com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Example 72 with Description

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();
}
Also used : EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) ImageSettingsTestDto(com.sequenceiq.it.cloudbreak.dto.ImageSettingsTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) ClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

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