use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class ImageCatalogTest method testGetImageCatalogsRequestFromExistingImageCatalog.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "image catalog get request", when = "calling get request on catalog endpoint", then = "getting back the catalog request")
public void testGetImageCatalogsRequestFromExistingImageCatalog(MockedTestContext testContext) {
String imgCatalogName = resourcePropertyProvider().getName();
testContext.given(imgCatalogName, ImageCatalogTestDto.class).withName(imgCatalogName).withUrl(getImageCatalogMockServerSetup().getImageCatalogUrl()).when(imageCatalogTestClient.createV4(), key(imgCatalogName)).select(ImageCatalogTestDto::getRequest, key(imgCatalogName)).when((testContext1, entity, cloudbreakClient) -> {
ImageCatalogV4Request request = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().getRequest(cloudbreakClient.getWorkspaceId(), imgCatalogName);
entity.setRequest(request);
return entity;
}).then((testContext1, entity, cloudbreakClient) -> {
ImageCatalogV4Request imgCatReq = testContext1.getSelected(imgCatalogName);
if (entity.getRequest().equals(imgCatReq)) {
throw new IllegalArgumentException("The requests are not identical.");
}
return entity;
}).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class ImageCatalogTest method testUpdateImageCatalog.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "image catalog update request", when = "calling update request with new url", then = "the image catalog list should contains the new url")
public void testUpdateImageCatalog(MockedTestContext testContext) {
String imgCatalogName = resourcePropertyProvider().getName();
testContext.given(imgCatalogName, ImageCatalogTestDto.class).withName(imgCatalogName).withUrl(getImageCatalogMockServerSetup().getImageCatalogUrl()).when(imageCatalogTestClient.createV4(), key(imgCatalogName)).select(ImageCatalogTestDto::getResponse, key(imgCatalogName)).when((testContext1, entity, cloudbreakClient) -> {
ImageCatalogV4Response originalResponse = entity.getResponse();
UpdateImageCatalogV4Request updateRequest = new UpdateImageCatalogV4Request();
updateRequest.setCrn(originalResponse.getCrn());
updateRequest.setName(originalResponse.getName());
updateRequest.setUrl(IMG_CATALOG_URL);
ImageCatalogV4Response updateResponse = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().update(cloudbreakClient.getWorkspaceId(), updateRequest);
entity.setResponse(updateResponse);
return entity;
}, key(imgCatalogName)).then((testContext1, entity, cloudbreakClient) -> {
ImageCatalogV4Response originalRepsonse = testContext1.getSelected(imgCatalogName);
if (originalRepsonse.getUrl().equals(entity.getResponse().getUrl())) {
throw new IllegalArgumentException("The catalog URL should not be the same after update.");
}
return entity;
}, key(imgCatalogName)).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class CMDownscaleWithHttp500ResponsesTest method testDownscale.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a stack with upscale", when = "upscale to 15 it downscale to 6", then = "stack is running")
public void testDownscale(MockedTestContext testContext) {
ApiParcel parcel = parcelGeneratorUtil.getActivatedCDHParcel();
String clusterName = resourcePropertyProvider().getName();
parcelMockActivatorUtil.mockActivateWithDefaultParcels(testContext, clusterName, parcel);
testContext.given("cmpkey", DistroXClouderaManagerProductTestDto.class).withParcel("someParcel").withName(parcel.getProduct()).withVersion(parcel.getVersion()).given("cmanager", DistroXClouderaManagerTestDto.class).withClouderaManagerProduct("cmpkey").given("cmpclusterkey", DistroXClusterTestDto.class).withClouderaManager("cmanager").given(clusterName, DistroXTestDto.class).withName(clusterName).withCluster("cmpclusterkey").when(distroXTestClient.create(), key(clusterName)).mockCm().profile(PROFILE_RETURN_HTTP_500, 1).await(STACK_AVAILABLE, key(clusterName).withIgnoredStatues(Set.of(Status.UNREACHABLE))).when(distroXTestClient.scale("worker", 15)).await(STACK_AVAILABLE, key(clusterName).withPollingInterval(POLLING_INTERVAL).withIgnoredStatues(Set.of(Status.UNREACHABLE))).when(distroXTestClient.scale("worker", 6)).await(STACK_AVAILABLE, key(clusterName).withPollingInterval(POLLING_INTERVAL).withIgnoredStatues(Set.of(Status.UNREACHABLE))).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class MockSdxTests method testDefaultSDXCanBeCreatedThenDeletedSuccessfully.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "a valid SDX Internal Create request is sent", then = "SDX should be available AND deletable")
public void testDefaultSDXCanBeCreatedThenDeletedSuccessfully(MockedTestContext testContext) {
String sdxInternal = resourcePropertyProvider().getName();
String networkKey = "someNetwork";
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(sdxInternal, SdxInternalTestDto.class).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).then((tc, testDto, client) -> sdxTestClient.deleteInternal().action(tc, testDto, client)).await(SdxClusterStatusResponse.DELETED, key(sdxInternal)).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class MockSdxUpgradeTests method testSdxUpgradeAfterResize.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "start an sdx cluster without attached disk on gateway, but disk attachment is supported on cloud provider side", then = "Upgrade option should be presented")
public void testSdxUpgradeAfterResize(MockedTestContext testContext) {
String upgradeImageCatalogName = resourcePropertyProvider().getName();
createImageCatalogForOsUpgrade(testContext, upgradeImageCatalogName);
String sdxInternal = resourcePropertyProvider().getName();
String stack = resourcePropertyProvider().getName();
String cluster = "cmcluster";
String imageSettings = "imageSettingsUpgrade";
String networkKey = "someOtherNetwork";
testContext.given(networkKey, EnvironmentNetworkTestDto.class).withMock(new EnvironmentNetworkMockParams()).given(EnvironmentTestDto.class).withNetwork(networkKey).withCreateFreeIpa(Boolean.TRUE).withName(resourcePropertyProvider().getEnvironmentName()).withBackup("location/of/the/backup").when(getEnvironmentTestClient().create()).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).when(freeIpaTestClient.create()).await(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.AVAILABLE).given(cluster, ClusterTestDto.class).given(imageSettings, ImageSettingsTestDto.class).withImageId("aaa778fc-7f17-4535-9021-515351df3691").withImageCatalog(upgradeImageCatalogName).given("NoAttachedDisksTemplate", InstanceTemplateV4TestDto.class).withAttachedVolume(testContext.init(VolumeV4TestDto.class).withCount(0)).given("InstanceGroupWithoutAttachedDisk", InstanceGroupTestDto.class).withHostGroup(HostGroupType.MASTER).withTemplate("NoAttachedDisksTemplate").given(stack, StackTestDto.class).withCluster(cluster).withImageSettings(imageSettings).replaceInstanceGroups("InstanceGroupWithoutAttachedDisk").given(sdxInternal, SdxInternalTestDto.class).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).when(sdxTestClient.resize(), key(sdxInternal)).await(SdxClusterStatusResponse.STOP_IN_PROGRESS, key(sdxInternal).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.STACK_CREATION_IN_PROGRESS, key(sdxInternal).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal).withWaitForFlow(Boolean.FALSE)).withClusterShape(SdxClusterShape.MEDIUM_DUTY_HA).then(SdxUpgradeTestAssertion.validateSuccessfulUpgrade()).validate();
}
Aggregations