Search in sources :

Example 11 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class SdxRangerRazEnabledTests method testCreateSdxWithoutRangerRaz.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak", when = "enableRangerRaz is called when Raz is not installed", then = "Exception is thrown")
public void testCreateSdxWithoutRangerRaz(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(SdxTestDto.class).withExternalDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().whenException(sdxTestClient.enableRangerRaz(), BadRequestException.class).validate();
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) BadRequestException(javax.ws.rs.BadRequestException) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 12 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class SdxSecurityTests method testSDXAutoTlsCertRotation.

@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "autotls cert rotation is called on the SDX cluster", then = "host certificates' validity should be changed on all hosts, the cluster should be up and running")
public void testSDXAutoTlsCertRotation(TestContext testContext) {
    String sdx = resourcePropertyProvider().getName();
    List<String> originalCertValidityOutput = new ArrayList<>();
    List<String> renewedCertValidityOutput = new ArrayList<>();
    SdxDatabaseRequest noDatabaseRequest = new SdxDatabaseRequest();
    noDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(noDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
        Map<String, Pair<Integer, String>> certValidityCmdResultByIpsMap = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName(), HostGroupType.IDBROKER.getName()), HOST_CERT_VALIDITY_CMD, false);
        originalCertValidityOutput.addAll(certValidityCmdResultByIpsMap.values().stream().map(Pair::getValue).collect(Collectors.toList()));
        return testDto;
    }).when(sdxTestClient.rotateAutotlsCertificates(), key(sdx)).await(SdxClusterStatusResponse.CERT_ROTATION_IN_PROGRESS, key(sdx).withWaitForFlow(false)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
        Map<String, Pair<Integer, String>> certValidityCmdResultByIpsMap = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName(), HostGroupType.IDBROKER.getName()), HOST_CERT_VALIDITY_CMD, false);
        renewedCertValidityOutput.addAll(certValidityCmdResultByIpsMap.entrySet().stream().map(e -> e.getValue().getValue()).collect(Collectors.toList()));
        return testDto;
    }).then((tc, testDto, client) -> compareCertValidityOutputs(testDto, originalCertValidityOutput, renewedCertValidityOutput)).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) 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) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) List(java.util.List) Pair(org.apache.commons.lang3.tuple.Pair) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Map(java.util.Map) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) SshJClientActions(com.sequenceiq.it.cloudbreak.util.ssh.action.SshJClientActions) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) ArrayList(java.util.ArrayList) Map(java.util.Map) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Pair(org.apache.commons.lang3.tuple.Pair) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 13 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class DistroXClusterCreationTest method sdxDatabaseRequestWithCreateTrue.

private SdxDatabaseRequest sdxDatabaseRequestWithCreateTrue() {
    SdxDatabaseRequest dbRequest = new SdxDatabaseRequest();
    dbRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NON_HA);
    return dbRequest;
}
Also used : SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest)

Example 14 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class SdxExternalDatabaseConfigurerTest method whenPlatformIsAzureWithoutRuntimeVerionSet.

@Test
public void whenPlatformIsAzureWithoutRuntimeVerionSet() {
    CloudPlatform cloudPlatform = CloudPlatform.AZURE;
    when(platformConfig.isExternalDatabaseSupportedFor(cloudPlatform)).thenReturn(true);
    when(platformConfig.isExternalDatabaseSupportedOrExperimental(CloudPlatform.AZURE)).thenReturn(true);
    SdxDatabaseRequest dbRequest = new SdxDatabaseRequest();
    SdxCluster sdxCluster = new SdxCluster();
    sdxCluster.setClusterName("clusterName");
    underTest.configure(cloudPlatform, dbRequest, sdxCluster);
    assertEquals(true, sdxCluster.isCreateDatabase());
    assertEquals(SdxDatabaseAvailabilityType.HA, sdxCluster.getDatabaseAvailabilityType());
}
Also used : CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Test(org.junit.jupiter.api.Test)

Example 15 with SdxDatabaseRequest

use of com.sequenceiq.sdx.api.model.SdxDatabaseRequest in project cloudbreak by hortonworks.

the class SdxExternalDatabaseConfigurerTest method whenPlatformIsAwsWithSkipCreateShouldNotCreateDatabase.

@Test
public void whenPlatformIsAwsWithSkipCreateShouldNotCreateDatabase() {
    CloudPlatform cloudPlatform = CloudPlatform.AWS;
    SdxDatabaseRequest dbRequest = new SdxDatabaseRequest();
    dbRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    SdxCluster sdxCluster = new SdxCluster();
    underTest.configure(cloudPlatform, dbRequest, sdxCluster);
    assertEquals(false, sdxCluster.isCreateDatabase());
    assertEquals(SdxDatabaseAvailabilityType.NONE, sdxCluster.getDatabaseAvailabilityType());
}
Also used : CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Test(org.junit.jupiter.api.Test)

Aggregations

SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)29 Description (com.sequenceiq.it.cloudbreak.context.Description)15 Test (org.testng.annotations.Test)15 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)10 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)10 Inject (javax.inject.Inject)10 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)9 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)9 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)9 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)9 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)8 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)8 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)8 SdxDatabaseAvailabilityType (com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType)8 Test (org.junit.jupiter.api.Test)8 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)5 AbstractE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)5 HostGroupType (com.sequenceiq.it.cloudbreak.cloud.HostGroupType)4 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)4 List (java.util.List)4