Search in sources :

Example 51 with Description

use of com.sequenceiq.it.cloudbreak.context.Description 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 52 with Description

use of com.sequenceiq.it.cloudbreak.context.Description 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 53 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class AzureAdlsGen2Tests method testCreateStopAndStartClusterWithAdlsGen2AndCloudStorage.

@Test(dataProvider = TEST_CONTEXT, enabled = false)
@Description(given = "there is a running cloudbreak", when = "a valid azure stack create request with attached ADLS Gen2 cloud storage and defined storage location is sent", and = "the stack is started", then = "the stack should be available AND deletable")
public void testCreateStopAndStartClusterWithAdlsGen2AndCloudStorage(TestContext testContext) {
    String name = resourcePropertyProvider().getName();
    CloudStorageRequest cloudStorageRequest = adlsGen2CloudStorageV4RequestWithStorageLocations(name);
    testContext.given("clusterWithAdlsGen2", ClusterTestDto.class).withCloudStorage(cloudStorageRequest).withName(name).given(StackTestDto.class).withCluster("clusterWithAdlsGen2").withName(name).when(stackTestClient.createV4()).await(STACK_AVAILABLE).then(stackTestClient.deleteV4()::action).then(stackContainsStorageLocations()).then(stackContainsAdlsGen2Properties()).validate();
}
Also used : CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)

Example 54 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class DistroXClusterCreationTest method testDistroxCloudStorage.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "a valid SDX create request is sent with an attached cloud storage", then = "DistroX should be available with the inherited cloud storage AND both the DistroX and the SDX is deletable")
public void testDistroxCloudStorage(MockedTestContext testContext) {
    String storageEnvKey = resourcePropertyProvider().getName();
    String sdxInternal = resourcePropertyProvider().getName();
    String networkKey = "someNetwork";
    testContext.given(networkKey, EnvironmentNetworkTestDto.class).withMock(new EnvironmentNetworkMockParams()).given(storageEnvKey, EnvironmentTestDto.class).withDescription("Env with telemetry").withLocation(ENVIRONMENT_LOCATION).withNetwork(networkKey).withTelemetry(telemetry()).withCreateFreeIpa(Boolean.FALSE).withMockIDBMS().when(getEnvironmentTestClient().create(), key(storageEnvKey)).await(EnvironmentStatus.AVAILABLE).when(getEnvironmentTestClient().describe(), key(storageEnvKey)).given(FreeIpaTestDto.class).withEnvironment(storageEnvKey).when(freeIpaTestClient.create()).await(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.AVAILABLE).given(sdxInternal, SdxInternalTestDto.class).withDatabase(sdxDatabaseRequestWithCreateTrue()).withCloudStorage(testStorage()).withEnvironmentKey(key(storageEnvKey)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).given(DIX_NET_KEY, DistroXNetworkTestDto.class).given(DIX_IMG_KEY, DistroXImageTestDto.class).withImageCatalog().withImageId(IMAGE_CATALOG_ID).given(CM_FOR_DISTRO_X, DistroXClouderaManagerTestDto.class).given(CLUSTER_KEY, DistroXClusterTestDto.class).withBlueprintName(getBlueprintName(testContext)).withValidateBlueprint(false).withClouderaManager(CM_FOR_DISTRO_X).withRdsConfigNames().given(DistroXTestDto.class).withEnvironmentKey(storageEnvKey).withCluster(CLUSTER_KEY).withImageSettings(DIX_IMG_KEY).withNetwork(DIX_NET_KEY).when(distroXClient.create(), key(DISTRO_X_STACK)).await(STACK_AVAILABLE).then(DistroXClusterCreationTest::distroxInheritedCloudStorage).then(DistroXClusterCreationTest::distroxCloudStorageLocationNotEmpty).validate();
}
Also used : EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) DistroXNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXNetworkTestDto) DistroXClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.clouderamanager.DistroXClouderaManagerTestDto) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) AbstractClouderaManagerTest(com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest) Test(org.testng.annotations.Test)

Example 55 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class RecipeClusterTest method testDeletedRecipeCannotBeAssignedToCluster.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a deleted recipe", when = "starting cluster with deleted recipe", then = "badrequest exception is received")
public void testDeletedRecipeCannotBeAssignedToCluster(MockedTestContext testContext) {
    LOGGER.info("testing recipe execution for type: {}", PRE_CLOUDERA_MANAGER_START.name());
    String recipeName = resourcePropertyProvider().getName();
    String stackName = resourcePropertyProvider().getName();
    String instanceGroupName = resourcePropertyProvider().getName();
    HostGroupType hostGroupTypeForRecipe = HostGroupType.WORKER;
    testContext.given(recipeName, RecipeTestDto.class).withName(recipeName).withContent(RECIPE_CONTENT).withRecipeType(PRE_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4(), RunningParameter.key(recipeName)).when(recipeTestClient.deleteV4(), RunningParameter.key(recipeName)).given(instanceGroupName, InstanceGroupTestDto.class).withHostGroup(hostGroupTypeForRecipe).withNodeCount(NODE_COUNT).withRecipes(recipeName).given(stackName, StackTestDto.class).replaceInstanceGroups(instanceGroupName).whenException(stackTestClient.createV4(), BadRequestException.class, expectedMessage(String.format("The given recipe does not exist" + " for the instance group \"%s\": %s", hostGroupTypeForRecipe.getName(), recipeName))).validate();
}
Also used : HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) BadRequestException(javax.ws.rs.BadRequestException) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) TestCaseDescription(com.sequenceiq.it.cloudbreak.context.TestCaseDescription) 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