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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations