Search in sources :

Example 1 with SdxInternalTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto in project cloudbreak by hortonworks.

the class ResourceCreator method createNewDataLake.

public SdxInternalTestDto createNewDataLake(TestContext testContext, EnvironmentTestDto environment) {
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    String name = resourcePropertyProvider.getName();
    return create(testContext.given(name, SdxInternalTestDto.class).withName(name).withEnvironmentName(environment.getName()).withDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)));
}
Also used : SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest)

Example 2 with SdxInternalTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto in project cloudbreak by hortonworks.

the class ResourceCreator method createDefaultDataLake.

public SdxInternalTestDto createDefaultDataLake(TestContext testContext) {
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    return create(testContext.given(SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)));
}
Also used : SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest)

Example 3 with SdxInternalTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto in project cloudbreak by hortonworks.

the class SdxBackupRestoreTest method testSDXBackupRestoreCanBeSuccessful.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Manowar SDX cluster in available state", when = "a basic SDX backup then restore request has been sent", then = "SDX restore should be done successfully")
public void testSDXBackupRestoreCanBeSuccessful(TestContext testContext) {
    SdxInternalTestDto sdxInternalTestDto = testContext.given(SdxInternalTestDto.class);
    String cloudStorageBaseLocation = sdxInternalTestDto.getResponse().getCloudStorageBaseLocation();
    String backupObject = "backups";
    testContext.given(SdxInternalTestDto.class).when(sdxTestClient.syncInternal()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().when(sdxTestClient.backupInternal(StringUtils.join(List.of(cloudStorageBaseLocation, backupObject), "/"), null)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::validateDatalakeBackupStatus).then(this::validateDatalakeStatus).then((tc, testDto, client) -> {
        getCloudFunctionality(tc).cloudStorageListContainer(cloudStorageBaseLocation, backupObject, true);
        return testDto;
    }).validate();
    testContext.given(SdxInternalTestDto.class).when(sdxTestClient.restoreInternal(backupId, null)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::validateDatalakeRestoreStatus).then(this::validateDatalakeStatus).validate();
}
Also used : Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) LoggerFactory(org.slf4j.LoggerFactory) Log(com.sequenceiq.it.cloudbreak.log.Log) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) StringUtils(org.apache.commons.lang3.StringUtils) String.format(java.lang.String.format) Description(com.sequenceiq.it.cloudbreak.context.Description) SdxRestoreStatusResponse(com.sequenceiq.sdx.api.model.SdxRestoreStatusResponse) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) PreconditionSdxE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.sdx.PreconditionSdxE2ETest) SdxBackupStatusResponse(com.sequenceiq.sdx.api.model.SdxBackupStatusResponse) List(java.util.List) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) Collections(java.util.Collections) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) PreconditionSdxE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.sdx.PreconditionSdxE2ETest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 4 with SdxInternalTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto 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);
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) 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)

Aggregations

SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)4 Description (com.sequenceiq.it.cloudbreak.context.Description)2 SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)2 Test (org.testng.annotations.Test)2 SdxClient (com.sequenceiq.it.cloudbreak.SdxClient)1 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)1 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)1 CredentialTestDto (com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto)1 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)1 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)1 Log (com.sequenceiq.it.cloudbreak.log.Log)1 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)1 PreconditionSdxE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.sdx.PreconditionSdxE2ETest)1 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)1 SdxBackupStatusResponse (com.sequenceiq.sdx.api.model.SdxBackupStatusResponse)1 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)1 SdxRestoreStatusResponse (com.sequenceiq.sdx.api.model.SdxRestoreStatusResponse)1 String.format (java.lang.String.format)1 Collections (java.util.Collections)1 List (java.util.List)1