Search in sources :

Example 26 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class SdxResizeTests method testSDXResize.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "resize called on the SDX cluster", then = "SDX resize should be successful, the cluster should be up and running")
public void testSDXResize(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    AtomicReference<String> expectedShape = new AtomicReference<>();
    AtomicReference<String> expectedCrn = new AtomicReference<>();
    AtomicReference<String> expectedName = new AtomicReference<>();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(sdx, SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).withClusterShape(SdxClusterShape.CUSTOM).when(sdxTestClient.createInternal(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
        expectedShape.set(sdxUtil.getShape(testDto, client));
        expectedCrn.set(sdxUtil.getCrn(testDto, client));
        expectedName.set(testDto.getName());
        return testDto;
    }).when(sdxTestClient.resize(), key(sdx)).await(SdxClusterStatusResponse.STOP_IN_PROGRESS, key(sdx).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.STACK_CREATION_IN_PROGRESS, key(sdx).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, dto, client) -> validateStackCrn(expectedCrn, dto)).then((tc, dto, client) -> validateCrn(expectedCrn, dto)).then((tc, dto, client) -> validateShape(dto)).then((tc, dto, client) -> validateClusterName(expectedName, dto)).validate();
}
Also used : SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) SdxClusterShape(com.sequenceiq.sdx.api.model.SdxClusterShape) LoggerFactory(org.slf4j.LoggerFactory) Log(com.sequenceiq.it.cloudbreak.log.Log) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) AtomicReference(java.util.concurrent.atomic.AtomicReference) String.format(java.lang.String.format) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) SdxUtil(com.sequenceiq.it.cloudbreak.util.SdxUtil) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) AtomicReference(java.util.concurrent.atomic.AtomicReference) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 27 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class AwsSdxSpotInstanceTest method testSdxOnSpotInstances.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running cloudbreak ", when = "creating an SDX with 100% spot percentage ", then = "SDX is started on spot instances, or fails with insufficient spot capacity")
public void testSdxOnSpotInstances(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    SdxDatabaseRequest database = new SdxDatabaseRequest();
    database.setCreate(false);
    testContext.given(SdxTestDto.class).withCloudStorage().withExternalDatabase(database).withSpotPercentage(100).when(sdxTestClient.create(), key(sdx)).then((tc, testDto, client) -> {
        testDto.await(STACK_CREATED, key(sdx));
        Map<String, Exception> exceptionMap = testContext.getExceptionMap();
        if (!exceptionMap.isEmpty()) {
            String key = testDto.getAwaitExceptionKey(STACK_CREATED);
            if (exceptionMap.containsKey(key)) {
                LOGGER.info("Awaiting STACK_CREATED failed, clearing exception to check status reason", exceptionMap.get(key));
                exceptionMap.remove(key);
            }
        }
        return testDto;
    }).when(sdxTestClient.describe()).then(assertSpotInstances()).validate();
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) Collection(java.util.Collection) LoggerFactory(org.slf4j.LoggerFactory) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Status(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status) Test(org.testng.annotations.Test) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) Assertion(com.sequenceiq.it.cloudbreak.assertion.Assertion) Map(java.util.Map) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) InstanceLifeCycle(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceLifeCycle) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Map(java.util.Map) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)

Example 28 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class AbstractIntegrationTest method createDatalakeWithoutDatabase.

protected void createDatalakeWithoutDatabase(TestContext testContext) {
    SdxDatabaseRequest database = new SdxDatabaseRequest();
    database.setCreate(false);
    testContext.given(SdxInternalTestDto.class).withDatabase(database).withCloudStorage(getCloudStorageRequest(testContext)).when(sdxTestClient.createInternal()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().when(sdxTestClient.describeInternal()).validate();
}
Also used : SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest)

Example 29 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class DistroXUpgradeTests method testDistroXUpgrades.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and two DistroX clusters in " + "available state, one cluster created with deafult catalog and one cluster created with production catalog", when = "upgrade called on both DistroX clusters", then = "Both DistroX upgrade should be successful," + " the clusters should be up and running")
public void testDistroXUpgrades(TestContext testContext) {
    String imageSettings = resourcePropertyProvider().getName();
    String currentRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeCurrentVersion();
    String targetRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeTargetVersion();
    String currentRuntimeVersion3rdParty = commonClusterManagerProperties.getUpgrade().getDistroXUpgrade3rdPartyCurrentVersion();
    String targetRuntimeVersion3rdParty = commonClusterManagerProperties.getUpgrade().getDistroXUpgrade3rdPartyTargetVersion();
    String sdxName = resourcePropertyProvider().getName();
    String distroXName = resourcePropertyProvider().getName();
    String distroX3rdPartyName = resourcePropertyProvider().getName();
    String thirdPartyCatalogName = resourcePropertyProvider().getName();
    AtomicReference<String> uuid = new AtomicReference<>();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(sdxName, SdxTestDto.class).withRuntimeVersion(currentRuntimeVersion).withCloudStorage(getCloudStorageRequest(testContext)).withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdxName)).await(SdxClusterStatusResponse.RUNNING, key(sdxName)).awaitForHealthyInstances().validate();
    testContext.given(distroXName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion)).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().when(distroXTestClient.create(), key(distroXName)).validate();
    createImageValidationSourceCatalog(testContext, commonClusterManagerProperties.getUpgrade().getImageCatalogUrl3rdParty(), thirdPartyCatalogName);
    uuid.set(getUuid(testContext, thirdPartyCatalogName, currentRuntimeVersion3rdParty));
    testContext.given(imageSettings, DistroXImageTestDto.class).withImageCatalog(thirdPartyCatalogName).withImageId(uuid.get()).given(distroX3rdPartyName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion3rdParty)).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().withImageSettings(imageSettings).when(distroXTestClient.create(), key(distroX3rdPartyName)).await(STACK_AVAILABLE, key(distroX3rdPartyName)).awaitForHealthyInstances().then((tc, testDto, client) -> checkImageId(testDto, uuid.get())).given(distroXName, DistroXTestDto.class).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).validate();
    testContext.given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion).given(distroXName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroXName)).given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion3rdParty).given(distroX3rdPartyName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroX3rdPartyName)).await(STACK_AVAILABLE, key(distroX3rdPartyName)).awaitForHealthyInstances().given(distroXName, DistroXTestDto.class).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).validate();
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) AtomicReference(java.util.concurrent.atomic.AtomicReference) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) CommonClusterManagerProperties(com.sequenceiq.it.cloudbreak.cloud.v4.CommonClusterManagerProperties) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) DistroXUpgradeTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXUpgradeTestDto) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) AwsAvailabilityZoneAssertion(com.sequenceiq.it.cloudbreak.assertion.distrox.AwsAvailabilityZoneAssertion) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) AwsAvailabilityZoneAssertion(com.sequenceiq.it.cloudbreak.assertion.distrox.AwsAvailabilityZoneAssertion) AtomicReference(java.util.concurrent.atomic.AtomicReference) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Aggregations

SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)29 Description (com.sequenceiq.it.cloudbreak.context.Description)15 Test (org.testng.annotations.Test)15 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)10 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)10 Inject (javax.inject.Inject)10 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)9 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)9 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)9 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)9 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)8 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)8 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)8 SdxDatabaseAvailabilityType (com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType)8 Test (org.junit.jupiter.api.Test)8 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)5 AbstractE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)5 HostGroupType (com.sequenceiq.it.cloudbreak.cloud.HostGroupType)4 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)4 List (java.util.List)4