use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams in project cloudbreak by hortonworks.
the class MockSdxTests method testSDXFromTemplateCanBeCreatedThenDeletedSuccessfully.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "a valid SDX Internal Create request is sent with Cluster Template", then = "SDX should be available AND deletable")
public void testSDXFromTemplateCanBeCreatedThenDeletedSuccessfully(MockedTestContext testContext) throws IOException {
String sdxInternal = resourcePropertyProvider().getName();
String networkKey = "someOtherNetwork";
JSONObject jsonObject = ResourceUtil.readResourceAsJson(applicationContext, TEMPLATE_JSON);
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).withTemplate(jsonObject).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.environment.api.v1.environment.model.EnvironmentNetworkMockParams in project cloudbreak by hortonworks.
the class MockSdxTests method testSDXCreateWithInvalidCustomInstanceTypesShouldFail.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "an invalid SDX Create request is sent with wrong custom instance type", then = "SDX create should be failed")
public void testSDXCreateWithInvalidCustomInstanceTypesShouldFail(MockedTestContext testContext) {
String sdx = 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(sdx, SdxTestDto.class).withCustomInstanceGroup("master", "small").when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.PROVISIONING_FAILED, key(sdx).withWaitForFlowFail()).then(this::validateSdxStatusReason).validate();
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams in project cloudbreak by hortonworks.
the class MockSdxUpgradeTests method testSdxUpgradeWhenNoAttachedDisksButEmbeddedDBShouldHaveBeenOnSelfConfiguredAttachedDisk.
@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 testSdxUpgradeWhenNoAttachedDisksButEmbeddedDBShouldHaveBeenOnSelfConfiguredAttachedDisk(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()).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).then(SdxUpgradeTestAssertion.validateSuccessfulUpgrade()).validate();
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams 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();
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams in project cloudbreak by hortonworks.
the class MockSdxUpgradeTests method testSdxUpgradeSuccessfulWhenExternalDatabaseIsUsed.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running CloudSdxInternalTestDtobreak", when = "start an sdx cluster with external database", then = "Upgrade option should be presented")
public void testSdxUpgradeSuccessfulWhenExternalDatabaseIsUsed(MockedTestContext testContext) {
String upgradeImageCatalogName = resourcePropertyProvider().getName();
createImageCatalogForOsUpgrade(testContext, upgradeImageCatalogName);
String sdxInternal = resourcePropertyProvider().getName();
String stack = resourcePropertyProvider().getName();
String clouderaManager = "cm";
String cluster = "cmcluster";
String imageSettings = "imageSettingsUpgrade";
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.TRUE).withName(resourcePropertyProvider().getEnvironmentName()).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(RedbeamsDatabaseServerTestDto.class).withEnvironmentCrn(testContext.get(EnvironmentTestDto.class).getResponse().getCrn()).withClusterCrn(clusterCrn).when(redbeamsDatabaseServerTestClient.createV4()).await(Status.AVAILABLE).given(clouderaManager, ClouderaManagerTestDto.class).given(cluster, ClusterTestDto.class).withClouderaManager(clouderaManager).withExternalDatabaseCrn().given(imageSettings, ImageSettingsTestDto.class).withImageId("aaa778fc-7f17-4535-9021-515351df3691").withImageCatalog(upgradeImageCatalogName).given(stack, StackTestDto.class).withCluster(cluster).withImageSettings(imageSettings).given(sdxInternal, SdxInternalTestDto.class).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).then(SdxUpgradeTestAssertion.validateSuccessfulUpgrade()).validate();
}
Aggregations