Search in sources :

Example 1 with SdxTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto in project cloudbreak by hortonworks.

the class TagsUtilTest method addTestNameTagShouldAddTagToAbstractTestDtoWithTaggableRequest.

@Test
void addTestNameTagShouldAddTagToAbstractTestDtoWithTaggableRequest() {
    SdxTestDto testDto = new SdxTestDto(mock(TestContext.class));
    SdxClusterRequest request = new SdxClusterRequest();
    testDto.setRequest(request);
    when(testContext.getCloudPlatform()).thenReturn(CloudPlatform.MOCK);
    underTest.addTestNameTag(testContext.getCloudPlatform(), testDto, TEST_NAME);
    assertThat(request.getTags().get(TagsUtil.TEST_NAME_TAG)).isEqualTo(TEST_NAME);
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) Test(org.testng.annotations.Test)

Example 2 with SdxTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto 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)

Example 3 with SdxTestDto

use of com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method dnsLookups.

private void dnsLookups(SdxTestDto sdxTestDto, SdxClient sdxClient) {
    InstanceMetaDataV4Response instanceGroupMetadata = getInstanceGroups(sdxTestDto, sdxClient).stream().flatMap(instanceGroup -> instanceGroup.getMetadata().stream()).filter(metadata -> metadata.getInstanceGroup().equals("idbroker")).filter(metadata -> StringUtils.isNoneBlank(metadata.getDiscoveryFQDN(), metadata.getPrivateIp())).findFirst().orElseThrow(() -> new TestFailException("FreeIPA upgrade DNS lookups test failed, idbroker instance group was not found."));
    try {
        String cmd = String.format(CHECK_DNS_LOOKUPS_CMD, instanceGroupMetadata.getDiscoveryFQDN(), instanceGroupMetadata.getPrivateIp());
        Map<String, Pair<Integer, String>> results = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(sdxTestDto, sdxClient), List.of(HostGroupType.MASTER.getName()), cmd, false);
        results.values().forEach(result -> Assertions.assertEquals(0, result.getLeft()));
    } catch (Exception e) {
        logger.error("FreeIPA upgrade DNS lookups test failed with unexpected error", e);
        throw new TestFailException("FreeIPA upgrade DNS lookups test failed with unexpected error: " + e.getMessage(), e);
    }
}
Also used : SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) AddDnsZoneForSubnetsRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsZoneForSubnetsRequest) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) StringUtils(org.apache.commons.lang3.StringUtils) Description(com.sequenceiq.it.cloudbreak.context.Description) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) OperationStatus(com.sequenceiq.freeipa.api.v1.operation.model.OperationStatus) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) WorkloadCredentialsUpdateType(com.sequenceiq.freeipa.api.v1.freeipa.user.model.WorkloadCredentialsUpdateType) RUNNING(com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING) Status(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) Set(java.util.Set) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) SynchronizeAllUsersRequest(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizeAllUsersRequest) List(java.util.List) Response(javax.ws.rs.core.Response) WebApplicationException(javax.ws.rs.WebApplicationException) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) ServiceKeytabRequest(com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest) SshJClientActions(com.sequenceiq.it.cloudbreak.util.ssh.action.SshJClientActions) AbsolutTimeBasedTimeoutChecker(com.sequenceiq.cloudbreak.polling.AbsolutTimeBasedTimeoutChecker) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) BindUserCreateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest) TelemetryTestDto(com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto) HostKeytabRequest(com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.HostKeytabRequest) FreeIpaOperationStatusTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaOperationStatusTestDto) RunningParameter.waitForFlow(com.sequenceiq.it.cloudbreak.context.RunningParameter.waitForFlow) AddDnsARecordRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsARecordRequest) Inject(javax.inject.Inject) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) SynchronizationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus) COMPLETED(com.sequenceiq.freeipa.api.v1.operation.model.OperationState.COMPLETED) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) CleanupRequest(com.sequenceiq.freeipa.api.v1.freeipa.cleanup.CleanupRequest) AddDnsCnameRecordRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsCnameRecordRequest) Assertions(org.junit.jupiter.api.Assertions) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) Collections(java.util.Collections) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Pair(org.apache.commons.lang3.tuple.Pair)

Aggregations

TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)3 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)3 Test (org.testng.annotations.Test)3 FreeIpaTestClient (com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient)2 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)2 Description (com.sequenceiq.it.cloudbreak.context.Description)2 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)2 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)2 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)2 List (java.util.List)2 Set (java.util.Set)2 Inject (javax.inject.Inject)2 InstanceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus)1 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)1 InstanceMetaDataV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response)1 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)1 AbsolutTimeBasedTimeoutChecker (com.sequenceiq.cloudbreak.polling.AbsolutTimeBasedTimeoutChecker)1 AddDnsARecordRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsARecordRequest)1 AddDnsCnameRecordRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsCnameRecordRequest)1 AddDnsZoneForSubnetsRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsZoneForSubnetsRequest)1