Search in sources :

Example 46 with Description

use of com.sequenceiq.it.cloudbreak.context.Description 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();
}
Also used : JSONObject(org.json.JSONObject) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 47 with Description

use of com.sequenceiq.it.cloudbreak.context.Description 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();
}
Also used : EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 48 with Description

use of com.sequenceiq.it.cloudbreak.context.Description 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();
}
Also used : EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) ImageSettingsTestDto(com.sequenceiq.it.cloudbreak.dto.ImageSettingsTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) VolumeV4TestDto(com.sequenceiq.it.cloudbreak.dto.VolumeV4TestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 49 with Description

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

the class SdxRangerRazEnabledTests method testCreateSdxWithRangerRaz.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak", when = "enableRangerRaz is called when Raz is installed", then = "rangerRazEnabled is set for Sdx")
public void testCreateSdxWithRangerRaz(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(SdxTestDto.class).withExternalDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).withRangerRazEnabled(Boolean.TRUE).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().when(sdxTestClient.enableRangerRaz()).then((tc, testDto, client) -> {
        final boolean rangerRazEnabled = testDto.getResponse().getRangerRazEnabled();
        if (!rangerRazEnabled) {
            throw new TestFailException("Ranger raz was not enabled!");
        }
        return testDto;
    }).validate();
}
Also used : Inject(javax.inject.Inject) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) BadRequestException(javax.ws.rs.BadRequestException) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 50 with Description

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

the class SdxRepairTests method testSDXRepairMasterAndIDBRokerWithStoppedEC2Instance.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "recovery called on the MASTER and then the IDBROKER host group, where the EC2 instance had been stopped", then = "SDX recovery should be successful, the cluster should be up and running")
public void testSDXRepairMasterAndIDBRokerWithStoppedEC2Instance(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    DescribeFreeIpaResponse describeFreeIpaResponse = testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).getResponse();
    SdxTestDto sdxTestDto = testContext.given(sdx, SdxTestDto.class).withCloudStorage(getCloudStorageRequest(testContext)).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances();
    repair(sdxTestDto, sdx, MASTER.getName(), Set.of(SdxClusterStatusResponse.CLUSTER_UNREACHABLE));
    repair(sdxTestDto, sdx, IDBROKER.getName(), Set.of(SdxClusterStatusResponse.NODE_FAILURE));
    sdxTestDto.then((tc, testDto, client) -> {
        getCloudFunctionality(tc).cloudStorageListContainerDataLake(getBaseLocation(testDto), testDto.getResponse().getName(), testDto.getResponse().getStackCrn());
        return testDto;
    }).then((tc, testDto, client) -> {
        getCloudFunctionality(tc).cloudStorageListContainerFreeIpa(getBaseLocation(testDto), describeFreeIpaResponse.getName(), describeFreeIpaResponse.getCrn());
        return testDto;
    }).validate();
}
Also used : SdxClusterShape(com.sequenceiq.sdx.api.model.SdxClusterShape) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) ArrayList(java.util.ArrayList) Description(com.sequenceiq.it.cloudbreak.context.Description) HashSet(java.util.HashSet) Inject(javax.inject.Inject) SdxUtil(com.sequenceiq.it.cloudbreak.util.SdxUtil) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) MASTER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER) InstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus) Set(java.util.Set) IDBROKER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) StackTestClient(com.sequenceiq.it.cloudbreak.client.StackTestClient) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) List(java.util.List) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) VolumeUtils(com.sequenceiq.it.cloudbreak.util.VolumeUtils) RecipeTestClient(com.sequenceiq.it.cloudbreak.client.RecipeTestClient) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) 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