Search in sources :

Example 31 with Description

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

the class RedbeamsDatabaseServerTest method createRedbeamsDatabaseServerTest.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a prepared database", when = "when a database create request is sent with the same database name", then = "the create should return a BadRequestException")
public void createRedbeamsDatabaseServerTest(MockedTestContext testContext) {
    String databaseName = resourcePropertyProvider().getName();
    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.FALSE).withName(resourcePropertyProvider().getEnvironmentName()).when(getEnvironmentTestClient().create()).await(EnvironmentStatus.AVAILABLE).given(RedbeamsDatabaseServerTestDto.class).withName(databaseName).withClusterCrn(clusterCrn).when(redbeamsDatabaseServerTest.createV4()).await(Status.AVAILABLE).when(redbeamsDatabaseServerTest.deleteV4()).await(Status.DELETE_COMPLETED).validate();
}
Also used : EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) RedbeamsDatabaseServerTestDto(com.sequenceiq.it.cloudbreak.dto.database.RedbeamsDatabaseServerTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 32 with Description

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

the class DistroXClusterCreationTest method testWhenEnvIsStoppedUnableToCreateDistroX.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a stopped environment", when = "a DistroX creation request sent", then = "its creation should not be started due to the unavailability of the environment")
public void testWhenEnvIsStoppedUnableToCreateDistroX(MockedTestContext testContext) {
    EnvironmentTestDto environment = testContext.get(EnvironmentTestDto.class);
    givenAnEnvironmentInStoppedState(testContext).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).given(DistroXTestDto.class).withCluster(CLUSTER_KEY).withImageSettings(DIX_IMG_KEY).withNetwork(DIX_NET_KEY).whenException(distroXClient.create(), BadRequestException.class, expectedMessage(String.format("If you want to provision a Data Hub then the FreeIPA instance must be running in the '%s' Environment.", environment.getName()))).validate();
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) BadRequestException(javax.ws.rs.BadRequestException) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) AbstractClouderaManagerTest(com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest) Test(org.testng.annotations.Test)

Example 33 with Description

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

the class DistroXClusterUpscaleDownscaleTest method testScaleDownAndUp.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running DistroX cluster", when = "a scale, start stop called many times", then = "the cluster should be available")
public void testScaleDownAndUp(MockedTestContext testContext, ITestContext testNgContext) {
    DistroXStartStopTestParameters params = new DistroXStartStopTestParameters(testNgContext.getCurrentXmlTest().getAllParameters());
    String stack = resourcePropertyProvider().getName();
    createDatalake(testContext);
    DistroXTestDto currentContext = testContext.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).withValidateBlueprint(false).withClouderaManager(CM_FOR_DISTRO_X).given(stack, DistroXTestDto.class).withCluster(CLUSTER_KEY).withName(stack).withImageSettings(DIX_IMG_KEY).withNetwork(DIX_NET_KEY).when(distroXClient.create(), key(stack)).await(STACK_AVAILABLE, key(stack));
    for (int i = 0; i < 3; i++) {
        currentContext = currentContext.when(distroXClient.scale(params.getHostgroup(), UPPER_NODE_COUNT)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
        currentContext = currentContext.when(distroXClient.scale(params.getHostgroup(), LOWER_NODE_COUNT)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
    }
    currentContext.validate();
}
Also used : DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) AbstractClouderaManagerTest(com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest) Test(org.testng.annotations.Test)

Example 34 with Description

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

the class ImageCatalogChangeTest method testFreeipaImageCatalogChange.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a running Freeipa/Datalake/Datahub", when = "calling change image catalog", then = "it should have new image catalog")
public void testFreeipaImageCatalogChange(MockedTestContext testContext) {
    // Freeipa
    final String newImageCatalog = testContext.given(FreeIpaTestDto.class).getResponse().getImage().getCatalog() + "&changed=true";
    testContext.given(FreeipaChangeImageCatalogTestDto.class).withImageCatalog(newImageCatalog).when(freeIpaTestClient.changeImageCatalog()).given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).then((testContext1, testDto, client) -> {
        final String actualCatalog = testDto.getResponse().getImage().getCatalog();
        if (!newImageCatalog.equals(actualCatalog)) {
            throw new TestFailException(String.format("Image catalog of Freeipa was not changed. Catalog : %s", actualCatalog));
        }
        return testDto;
    });
    // Datalake
    testContext.given(SdxInternalTestDto.class).when(sdxTestClient.createInternal()).await(SdxClusterStatusResponse.RUNNING);
    final StackImageV4Response sdxImage = testContext.given(SdxInternalTestDto.class).getResponse().getStackV4Response().getImage();
    final String sdxNewImageCatalogName = createNewImageCatalog(testContext, sdxImage);
    testContext.given(SdxChangeImageCatalogTestDto.class).withImageCatalog(sdxNewImageCatalogName).when(sdxTestClient.changeImageCatalog()).given(SdxInternalTestDto.class).when(sdxTestClient.describeInternal()).then((testContext1, testDto, client) -> {
        final String actualCatalog = testDto.getResponse().getStackV4Response().getImage().getCatalogName();
        if (!sdxNewImageCatalogName.equals(actualCatalog)) {
            throw new TestFailException(String.format("Image catalog of Datalake was not changed. Catalog : %s", actualCatalog));
        }
        return testDto;
    });
    // Datahub
    testContext.given(DistroXTestDto.class).when(distroXClient.create()).await(STACK_AVAILABLE);
    final StackImageV4Response distroXImage = testContext.given(DistroXTestDto.class).getResponse().getImage();
    final String distroXNewImageCatalogName = createNewImageCatalog(testContext, distroXImage);
    testContext.given(DistroXChangeImageCatalogTestDto.class).withImageCatalog(distroXNewImageCatalogName).when(distroXClient.changeImageCatalog()).given(DistroXTestDto.class).when(distroXClient.get()).then((testContext1, testDto, client) -> {
        final String actualCatalog = testDto.getResponse().getImage().getCatalogName();
        if (!distroXNewImageCatalogName.equals(actualCatalog)) {
            throw new TestFailException(String.format("Image catalog of Datahub was not changed. Catalog : %s", actualCatalog));
        }
        return testDto;
    }).validate();
}
Also used : ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) FreeipaChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaChangeImageCatalogTestDto) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) StackImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response) DistroXChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXChangeImageCatalogTestDto) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) SdxChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxChangeImageCatalogTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) NotNull(org.jetbrains.annotations.NotNull) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) FreeipaChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaChangeImageCatalogTestDto) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) StackImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response) SdxChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxChangeImageCatalogTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 35 with Description

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

the class ImageCatalogTest method testGetImageCatalogWhenCatalogDoesNotContainTheRequestedProvider.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "image catalog get the default catalog with AWS provider but catalog does not contain AWS entry", when = "calling get on the default", then = "the response does not contains AWS images")
public void testGetImageCatalogWhenCatalogDoesNotContainTheRequestedProvider(MockedTestContext testContext) {
    String imgCatalogName = resourcePropertyProvider().getName();
    testContext.given(imgCatalogName, ImageCatalogTestDto.class).withName(imgCatalogName).withUrl(getImageCatalogMockServerSetup().getImageCatalogUrl()).when(imageCatalogTestClient.createV4(), key(imgCatalogName)).when(new ImageCatalogGetImagesByNameAction(CloudPlatform.AWS), key(imgCatalogName)).then((testContext1, entity, cloudbreakClient) -> {
        ImagesV4Response catalog = entity.getResponseByProvider();
        if (!catalog.getBaseImages().isEmpty()) {
            throw new IllegalArgumentException("The Images response should NOT contain results for AWS provider.");
        }
        return entity;
    }).validate();
}
Also used : ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) ImageCatalogV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Responses) UpdateImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request) StackTestClient(com.sequenceiq.it.cloudbreak.client.StackTestClient) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) NotFoundException(javax.ws.rs.NotFoundException) ImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.ImageCatalogV4Request) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) ImageCatalogV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) ImageCatalogGetImagesByNameAction(com.sequenceiq.it.cloudbreak.action.v4.imagecatalog.ImageCatalogGetImagesByNameAction) BadRequestException(javax.ws.rs.BadRequestException) ImagesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response) RunningParameter.expectedMessage(com.sequenceiq.it.cloudbreak.context.RunningParameter.expectedMessage) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) ImageCatalogGetImagesByNameAction(com.sequenceiq.it.cloudbreak.action.v4.imagecatalog.ImageCatalogGetImagesByNameAction) ImagesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response) 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