Search in sources :

Example 1 with RUNNING

use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING in project cloudbreak by hortonworks.

the class DistroXService method validate.

private void validate(DistroXV1Request request) {
    DetailedEnvironmentResponse environment = Optional.ofNullable(environmentClientService.getByName(request.getEnvironmentName())).orElseThrow(() -> new BadRequestException("No environment name provided hence unable to obtain some important data"));
    if (environment == null) {
        throw new BadRequestException(format("'%s' Environment does not exist.", request.getEnvironmentName()));
    }
    DescribeFreeIpaResponse freeipa = freeipaClientService.getByEnvironmentCrn(environment.getCrn());
    if (freeipa == null || freeipa.getAvailabilityStatus() == null || !freeipa.getAvailabilityStatus().isAvailable()) {
        throw new BadRequestException(format("If you want to provision a Data Hub then the FreeIPA instance must be running in the '%s' Environment.", environment.getName()));
    }
    Set<String> sdxCrns = platformAwareSdxConnector.listSdxCrns(environment.getName(), environment.getCrn());
    if (sdxCrns.isEmpty()) {
        throw new BadRequestException(format("Data Lake stack cannot be found for environment CRN: %s (%s)", environment.getName(), environment.getCrn()));
    }
    Set<Pair<String, StatusCheckResult>> sdxCrnsWithAvailability = platformAwareSdxConnector.listSdxCrnsWithAvailability(environment.getName(), environment.getCrn(), sdxCrns);
    if (!sdxCrnsWithAvailability.stream().map(Pair::getValue).allMatch(statusCheckResult -> StatusCheckResult.AVAILABLE.equals(statusCheckResult))) {
        throw new BadRequestException("Data Lake stacks of environment should be available.");
    }
}
Also used : StackOperations(com.sequenceiq.distrox.v1.distrox.StackOperations) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) StatusCheckResult(com.sequenceiq.cloudbreak.saas.sdx.status.StatusCheckResult) Set(java.util.Set) WorkspaceService(com.sequenceiq.cloudbreak.service.workspace.WorkspaceService) EnvironmentClientService(com.sequenceiq.cloudbreak.service.environment.EnvironmentClientService) DistroXV1RequestToStackV4RequestConverter(com.sequenceiq.distrox.v1.distrox.converter.DistroXV1RequestToStackV4RequestConverter) String.format(java.lang.String.format) Inject(javax.inject.Inject) CloudbreakRestRequestThreadLocalService(com.sequenceiq.cloudbreak.structuredevent.CloudbreakRestRequestThreadLocalService) FreeipaClientService(com.sequenceiq.cloudbreak.service.freeipa.FreeipaClientService) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) Pair(org.apache.commons.lang3.tuple.Pair) Service(org.springframework.stereotype.Service) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Optional(java.util.Optional) PlatformAwareSdxConnector(com.sequenceiq.cloudbreak.saas.sdx.PlatformAwareSdxConnector) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXV1Request(com.sequenceiq.distrox.api.v1.distrox.model.DistroXV1Request) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Pair(org.apache.commons.lang3.tuple.Pair)

Example 2 with RUNNING

use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method syncUsers.

private void syncUsers(TestContext testContext, com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn, String accountId) {
    try {
        SyncOperationStatus lastSyncOperationStatus = ipaClient.getUserV1Endpoint().getLastSyncOperationStatus(environmentCrn);
        if (lastSyncOperationStatus.getStatus() == SynchronizationStatus.RUNNING) {
            waitToCompleted(testContext, lastSyncOperationStatus.getOperationId(), "Initial or periodic usersync");
        }
        SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest();
        request.setAccountId(accountId);
        request.setEnvironments(Set.of(environmentCrn));
        request.setWorkloadCredentialsUpdateType(WorkloadCredentialsUpdateType.FORCE_UPDATE);
        try {
            SyncOperationStatus syncOperationStatus = ipaClient.getUserV1Endpoint().synchronizeAllUsers(request);
            waitToCompleted(testContext, syncOperationStatus.getOperationId(), "Full forced usersync");
        } catch (WebApplicationException e) {
            if (e.getResponse() != null && Response.Status.CONFLICT.getStatusCode() == e.getResponse().getStatus()) {
                logger.info("Usersync is already running");
            } else {
                throw e;
            }
        }
    } catch (Exception e) {
        logger.error("Full forced usersync test failed during upgrade", e);
        throw new TestFailException("Full forced usersync test failed during upgrade with: " + e.getMessage(), e);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SynchronizeAllUsersRequest(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizeAllUsersRequest) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 3 with RUNNING

use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING in project cloudbreak by hortonworks.

the class AwsYcloudHybridCloudTest method testCreateSdxOnChildEnvironment.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak with parent-child environments ", when = "a valid SDX create request is sent to the child environment ", then = "SDX is created and instances are accessible via ssh by valid username and password ", and = "instances are not accessible via ssh by invalid username and password")
public void testCreateSdxOnChildEnvironment(TestContext testContext) {
    String sdxInternal = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
    String clouderaManager = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
    String cluster = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
    String cmProduct = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
    String stack = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
    AtomicReference<String> cdhVersion = new AtomicReference<>();
    AtomicReference<String> cdhParcel = new AtomicReference<>();
    String runtimeVersion = commonClusterManagerProperties().getRuntimeVersion();
    testContext.given(StackMatrixTestDto.class, CHILD_CLOUD_PLATFORM).when(utilTestClient.stackMatrixV4()).then((tc, dto, client) -> {
        ClouderaManagerStackDescriptorV4Response response = dto.getResponse().getCdh().get(runtimeVersion);
        cdhVersion.set(response.getVersion());
        cdhParcel.set(response.getRepository().getStack().get(REDHAT7));
        return dto;
    }).validate();
    testContext.given("telemetry", TelemetryTestDto.class).withLogging(CHILD_CLOUD_PLATFORM).withReportClusterLogs().given(cmProduct, ClouderaManagerProductTestDto.class, CHILD_CLOUD_PLATFORM).withName(CDH).withVersion(cdhVersion.get()).withParcel(cdhParcel.get()).given(clouderaManager, ClouderaManagerTestDto.class, CHILD_CLOUD_PLATFORM).withClouderaManagerProduct(cmProduct).given(cluster, ClusterTestDto.class, CHILD_CLOUD_PLATFORM).withBlueprintName(getDefaultSDXBlueprintName()).withValidateBlueprint(Boolean.FALSE).withClouderaManager(clouderaManager).given(MASTER_INSTANCE_GROUP, InstanceGroupTestDto.class, CHILD_CLOUD_PLATFORM).withHostGroup(MASTER).withNodeCount(1).given(IDBROKER_INSTANCE_GROUP, InstanceGroupTestDto.class, CHILD_CLOUD_PLATFORM).withHostGroup(IDBROKER).withNodeCount(1).given(STACK_AUTHENTICATION, StackAuthenticationTestDto.class, CHILD_CLOUD_PLATFORM).given(stack, StackTestDto.class, CHILD_CLOUD_PLATFORM).withCluster(cluster).withInstanceGroups(MASTER_INSTANCE_GROUP, IDBROKER_INSTANCE_GROUP).withStackAuthentication(STACK_AUTHENTICATION).withTelemetry("telemetry").given(sdxInternal, SdxInternalTestDto.class, CHILD_CLOUD_PLATFORM).withStackRequest(key(cluster), key(stack)).withEnvironmentKey(RunningParameter.key(CHILD_ENVIRONMENT_KEY)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, dto, client) -> {
        String environmentCrn = dto.getResponse().getEnvironmentCrn();
        com.sequenceiq.freeipa.api.client.FreeIpaClient freeIpaClient = tc.getMicroserviceClient(FreeIpaClient.class).getDefaultClient();
        checkUserSyncState(environmentCrn, freeIpaClient);
        String username = testContext.getActingUserCrn().getResource();
        String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
        for (InstanceGroupV4Response ig : dto.getResponse().getStackV4Response().getInstanceGroups()) {
            for (InstanceMetaDataV4Response i : ig.getMetadata()) {
                String ip = i.getPublicIp();
                LOGGER.info("Trying to ssh with user {} into instance: {}", sanitizedUserName, OBJECT_MAPPER.writeValueAsString(i));
                testShhAuthenticationSuccessful(sanitizedUserName, ip);
                testShhAuthenticationFailure(sanitizedUserName, ip);
            }
        }
        return dto;
    }).given(CHILD_ENVIRONMENT_KEY, EnvironmentTestDto.class, CHILD_CLOUD_PLATFORM).when(environmentTestClient.cascadingDelete(), RunningParameter.key(CHILD_ENVIRONMENT_KEY)).await(EnvironmentStatus.ARCHIVED, RunningParameter.key(CHILD_ENVIRONMENT_KEY)).validate();
}
Also used : ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) LoggerFactory(org.slf4j.LoggerFactory) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) Description(com.sequenceiq.it.cloudbreak.context.Description) EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) StackMatrixTestDto(com.sequenceiq.it.cloudbreak.dto.util.StackMatrixTestDto) UserV1Endpoint(com.sequenceiq.freeipa.api.v1.freeipa.user.UserV1Endpoint) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) Map(java.util.Map) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) ClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto) InstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) SanitizerUtil(com.sequenceiq.cloudbreak.util.SanitizerUtil) SSHClient(net.schmizz.sshj.SSHClient) UtilTestClient(com.sequenceiq.it.cloudbreak.client.UtilTestClient) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus) ClouderaManagerProductTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerProductTestDto) BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) TelemetryTestDto(com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto) CredentialTestDto(com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto) EnvironmentUserSyncState(com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState) HashMap(java.util.HashMap) PromiscuousVerifier(net.schmizz.sshj.transport.verification.PromiscuousVerifier) AtomicReference(java.util.concurrent.atomic.AtomicReference) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) StackAuthenticationTestDto(com.sequenceiq.it.cloudbreak.dto.StackAuthenticationTestDto) UserAuthException(net.schmizz.sshj.userauth.UserAuthException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) CredentialTestClient(com.sequenceiq.it.cloudbreak.client.CredentialTestClient) BlueprintTestClient(com.sequenceiq.it.cloudbreak.client.BlueprintTestClient) Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) MASTER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IDBROKER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) ClouderaManagerStackDescriptorV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) RunningParameter(com.sequenceiq.it.cloudbreak.context.RunningParameter) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) AtomicReference(java.util.concurrent.atomic.AtomicReference) ClouderaManagerStackDescriptorV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) StackMatrixTestDto(com.sequenceiq.it.cloudbreak.dto.util.StackMatrixTestDto) TelemetryTestDto(com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto) 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 4 with RUNNING

use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING in project cloudbreak by hortonworks.

the class DistroXRepairTests method testEphemeralDistroXMasterRepairWithTerminatedInstances.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running environment with FreeIPA and SDX in available state", when = "a new DistroX should be created", and = "MASTER host group should be recovered, where the instance had been terminated", then = "DistroX recovery should be successful, the cluster should be up and running with same volumes")
public void testEphemeralDistroXMasterRepairWithTerminatedInstances(TestContext testContext) {
    String distrox = resourcePropertyProvider().getName();
    List<String> actualVolumeIds = new ArrayList<>();
    List<String> expectedVolumeIds = new ArrayList<>();
    String userCrn = testContext.getActingUserCrn().toString();
    String workloadUsername = testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).when(umsTestClient.getUserDetails(userCrn, regionAwareInternalCrnGeneratorFactory)).getResponse().getWorkloadUsername();
    testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.getLastSyncOperationStatus()).await(OperationState.COMPLETED).given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).when(umsTestClient.setWorkloadPassword(workloadPassword, regionAwareInternalCrnGeneratorFactory)).given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.syncAll()).await(OperationState.COMPLETED).given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).validate();
    testContext.given(DistroXTestDto.class).when(distroXTestClient.get()).then(this::verifyMountedDisks).then((tc, testDto, client) -> {
        List<InstanceGroupV4Response> instanceGroups = testDto.getResponse().getInstanceGroups();
        return sshJUtil.checkMeteringStatus(testDto, instanceGroups, List.of(MASTER.getName()));
    }).then((tc, testDto, client) -> {
        CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
        List<String> instancesToDelete = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
        expectedVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instancesToDelete));
        cloudFunctionality.deleteInstances(testDto.getName(), instancesToDelete);
        return testDto;
    }).awaitForHostGroup(MASTER.getName(), InstanceStatus.DELETED_ON_PROVIDER_SIDE).when(distroXTestClient.repair(MASTER), key(distrox)).await(STACK_AVAILABLE, key(distrox)).awaitForHealthyInstances().then(this::verifyMountedDisks).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroups(testDto, workloadUsername, workloadPassword)).then((tc, testDto, client) -> {
        CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
        List<String> instanceIds = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
        actualVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instanceIds));
        return testDto;
    }).then((tc, testDto, client) -> VolumeUtils.compareVolumeIdsAfterRepair(testDto, actualVolumeIds, expectedVolumeIds)).validate();
}
Also used : UmsTestDto(com.sequenceiq.it.cloudbreak.dto.ums.UmsTestDto) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) ArrayList(java.util.ArrayList) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) UmsTestClient(com.sequenceiq.it.cloudbreak.client.UmsTestClient) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) OperationState(com.sequenceiq.freeipa.api.v1.operation.model.OperationState) ClouderaManagerUtil(com.sequenceiq.it.cloudbreak.util.clouderamanager.ClouderaManagerUtil) MASTER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER) InstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) SshJUtil(com.sequenceiq.it.cloudbreak.util.ssh.SshJUtil) List(java.util.List) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) DistroxUtil(com.sequenceiq.it.cloudbreak.util.DistroxUtil) CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) VolumeUtils(com.sequenceiq.it.cloudbreak.util.VolumeUtils) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) FreeIpaUserSyncTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaUserSyncTestDto) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) ArrayList(java.util.ArrayList) FreeIpaUserSyncTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaUserSyncTestDto) ArrayList(java.util.ArrayList) List(java.util.List) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) 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) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 5 with RUNNING

use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING in project cloudbreak by hortonworks.

the class SdxCloudStorageTest method testSDXWithDataLakeAndFreeIpaStorageCanBeCreatedSuccessfully.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak", when = "a basic SDX create request with FreeIPA and DataLake Cloud Storage has been sent", then = "SDX should be available along with the created Cloud storage objects")
public void testSDXWithDataLakeAndFreeIpaStorageCanBeCreatedSuccessfully(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    DescribeFreeIpaResponse describeFreeIpaResponse = testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).getResponse();
    testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().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 : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) AmazonS3Util(com.sequenceiq.it.cloudbreak.util.aws.amazons3.AmazonS3Util) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Aggregations

Inject (javax.inject.Inject)6 DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)4 Description (com.sequenceiq.it.cloudbreak.context.Description)4 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)4 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)4 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)4 Test (org.testng.annotations.Test)4 InstanceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus)3 SyncOperationStatus (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus)3 Stack (com.sequenceiq.freeipa.entity.Stack)3 FreeIpaTestClient (com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient)3 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)3 MASTER (com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER)3 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)3 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)3 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Set (java.util.Set)3 Value (org.springframework.beans.factory.annotation.Value)3