Search in sources :

Example 16 with UseSpotInstances

use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.

the class DistroXUpgradeTests method testDistroXEphemeralUpgrade.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and DistroX cluster in available state", when = "upgrade called on the DistroX cluster", then = "DistroX upgrade should be successful, the cluster should be up and running")
public void testDistroXEphemeralUpgrade(TestContext testContext) {
    String sdxName = resourcePropertyProvider().getName();
    String distroXName = resourcePropertyProvider().getName();
    String currentRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeCurrentVersion();
    String targetRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeTargetVersion();
    String username = testContext.getActingUserCrn().getResource();
    String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
    testContext.given(sdxName, SdxTestDto.class).withCloudStorage().withRuntimeVersion(currentRuntimeVersion).when(sdxTestClient.create(), key(sdxName)).await(SdxClusterStatusResponse.RUNNING, key(sdxName)).awaitForHealthyInstances().validate();
    testContext.given(distroXName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion)).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withStorageOptimizedInstancetype().build()).when(distroXTestClient.create(), key(distroXName)).await(STACK_AVAILABLE).awaitForHealthyInstances().validate();
    testContext.given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion).given(distroXName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroXName)).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then((tc, testDto, client) -> {
        CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
        List<InstanceGroupV4Response> instanceGroups = testDto.getResponse().getInstanceGroups();
        cloudFunctionality.checkMountedDisks(instanceGroups, List.of(HostGroupType.WORKER.getName()));
        return testDto;
    }).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroupsDirect(testDto, sanitizedUserName, MOCK_UMS_PASSWORD)).validate();
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ClouderaManagerUtil(com.sequenceiq.it.cloudbreak.util.clouderamanager.ClouderaManagerUtil) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) SanitizerUtil(com.sequenceiq.cloudbreak.util.SanitizerUtil) List(java.util.List) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) CommonClusterManagerProperties(com.sequenceiq.it.cloudbreak.cloud.v4.CommonClusterManagerProperties) CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) DistroXUpgradeTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXUpgradeTestDto) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) DistroXInstanceGroupsBuilder(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXInstanceGroupsBuilder) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) DistroXInstanceGroupsBuilder(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXInstanceGroupsBuilder) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 17 with UseSpotInstances

use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.

the class DistroXEncryptedVolumeTest method testCreateDistroXWithEncryptedVolumes.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a valid credential for the selected provider", when = "new environment and freeIpa with encrypted volume should be created", and = "SDX then distroX with encrypted volumes also should be created for environment", then = "freeIpa, sdx and distroX volumes should be encrypted with the provided key")
public void testCreateDistroXWithEncryptedVolumes(TestContext testContext) {
    DistroXDatabaseRequest distroXDatabaseRequest = new DistroXDatabaseRequest();
    List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withDiskEncryption().build();
    distroXDatabaseRequest.setAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA);
    testContext.given(EnvironmentNetworkTestDto.class).given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(EnvironmentTestDto.class).withNetwork().withResourceEncryption().withTelemetry("telemetry").withTunnel(Tunnel.CLUSTER_PROXY).withCreateFreeIpa(Boolean.FALSE).when(environmentTestClient.create()).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).withEnvironment().withTelemetry("telemetry").withCatalog(commonCloudProperties().getImageValidation().getFreeIpaImageCatalog(), commonCloudProperties().getImageValidation().getFreeIpaImageUuid()).when(freeIpaTestClient.create()).await(Status.AVAILABLE).awaitForHealthyInstances().given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.getLastSyncOperationStatus()).await(OperationState.COMPLETED).given(EnvironmentTestDto.class).when(environmentTestClient.describe()).then(this::verifyEnvironmentResponseDiskEncryptionKey).given(FreeIpaTestDto.class).then(this::verifyFreeIpaVolumeEncryptionKey).given(SdxTestDto.class).withCloudStorage().when(sdxTestClient.create()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::verifySdxVolumeEncryptionKey).given(DistroXTestDto.class).withInstanceGroupsEntity(distroXInstanceGroupTestDtos).withExternalDatabase(distroXDatabaseRequest).when(distroXTestClient.create()).await(STACK_AVAILABLE).awaitForHealthyInstances().then(this::verifyDistroxVolumeEncryptionKey).then(this::verifyAwsEnaDriver).then(new AwsAvailabilityZoneAssertion()).then(validateTemplateContainsExternalDatabaseHostname()).validate();
}
Also used : DistroXInstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXInstanceGroupTestDto) EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) AwsAvailabilityZoneAssertion(com.sequenceiq.it.cloudbreak.assertion.distrox.AwsAvailabilityZoneAssertion) DistroXDatabaseRequest(com.sequenceiq.distrox.api.v1.distrox.model.database.DistroXDatabaseRequest) DistroXInstanceGroupsBuilder(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXInstanceGroupsBuilder) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) ResourceGroupTest(com.sequenceiq.it.cloudbreak.ResourceGroupTest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 18 with UseSpotInstances

use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.

the class DistroXImagesTests method testDistroXWithBaseImageCanBeCreatedSuccessfully.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak", when = "a valid DistroX create request is sent (latest Base Image)", then = "DistroX should be available and deletable")
public void testDistroXWithBaseImageCanBeCreatedSuccessfully(TestContext testContext) {
    String imageSettings = resourcePropertyProvider().getName();
    String imageCatalog = resourcePropertyProvider().getName();
    String distrox = resourcePropertyProvider().getName();
    AtomicReference<String> selectedImageID = new AtomicReference<>();
    CloudProvider cloudProvider = testContext.getCloudProvider();
    testContext.given(imageCatalog, ImageCatalogTestDto.class).when((tc, dto, client) -> {
        selectedImageID.set(cloudProvider.getLatestBaseImageID(tc, dto, client));
        return dto;
    }).given(imageSettings, DistroXImageTestDto.class).withImageCatalog(cloudProvider.getImageCatalogName()).withImageId(selectedImageID.get()).given(distrox, DistroXTestDto.class).withImageSettings(imageSettings).when(distroXTestClient.create(), key(distrox)).await(STACK_AVAILABLE).awaitForHealthyInstances().then((tc, dto, client) -> {
        Log.log(LOGGER, format(" Image Catalog Name: %s ", dto.getResponse().getImage().getCatalogName()));
        Log.log(LOGGER, format(" Image Catalog URL: %s ", dto.getResponse().getImage().getCatalogUrl()));
        Log.log(LOGGER, format(" Image ID: %s ", dto.getResponse().getImage().getId()));
        if (!dto.getResponse().getImage().getId().equals(selectedImageID.get())) {
            throw new TestFailException(" The selected image ID is: " + dto.getResponse().getImage().getId() + " instead of: " + selectedImageID.get());
        }
        return dto;
    }).validate();
}
Also used : Ignore(org.testng.annotations.Ignore) CloudProvider(com.sequenceiq.it.cloudbreak.cloud.v4.CloudProvider) Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) LoggerFactory(org.slf4j.LoggerFactory) InstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus) Log(com.sequenceiq.it.cloudbreak.log.Log) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) HashMap(java.util.HashMap) Test(org.testng.annotations.Test) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) AtomicReference(java.util.concurrent.atomic.AtomicReference) String.format(java.lang.String.format) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Map(java.util.Map) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) CloudProvider(com.sequenceiq.it.cloudbreak.cloud.v4.CloudProvider) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) AtomicReference(java.util.concurrent.atomic.AtomicReference) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Aggregations

Description (com.sequenceiq.it.cloudbreak.context.Description)18 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)18 Test (org.testng.annotations.Test)18 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)15 Inject (javax.inject.Inject)15 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)11 AbstractE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)11 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)10 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)10 List (java.util.List)9 Logger (org.slf4j.Logger)9 LoggerFactory (org.slf4j.LoggerFactory)9 DistroXTestClient (com.sequenceiq.it.cloudbreak.client.DistroXTestClient)8 HostGroupType (com.sequenceiq.it.cloudbreak.cloud.HostGroupType)8 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)8 SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)8 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)7 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)7 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)6 MASTER (com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER)6