Search in sources :

Example 11 with TestFailException

use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method generateHostKeyTab.

private void generateHostKeyTab(com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
    try {
        HostKeytabRequest hostKeytabRequest = new HostKeytabRequest();
        hostKeytabRequest.setEnvironmentCrn(environmentCrn);
        hostKeytabRequest.setServerHostName("test.local");
        hostKeytabRequest.setDoNotRecreateKeytab(Boolean.FALSE);
        ipaClient.getKerberosMgmtV1Endpoint().generateHostKeytab(hostKeytabRequest);
    } catch (Exception e) {
        logger.error("Generate Host keytab test failed during upgrade", e);
        throw new TestFailException("Generate Host keytab test failed during upgrade with: " + e.getMessage(), e);
    }
}
Also used : HostKeytabRequest(com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.HostKeytabRequest) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 12 with TestFailException

use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method cleanUp.

private void cleanUp(TestContext testContext, com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
    try {
        CleanupRequest cleanupRequest = new CleanupRequest();
        cleanupRequest.setEnvironmentCrn(environmentCrn);
        cleanupRequest.setClusterName("testuser");
        cleanupRequest.setUsers(Set.of("kerberosbind-testuser", "ldapbind-testuser"));
        OperationStatus operationStatus = ipaClient.getFreeIpaV1Endpoint().cleanup(cleanupRequest);
        waitToCompleted(testContext, operationStatus.getOperationId(), "cleanupOperation");
    } catch (Exception e) {
        logger.error("CLEANUP test failed during upgrade", e);
    // throw new TestFailException("CLEANUP test failed during upgrade with: " + e.getMessage(), e);
    }
}
Also used : OperationStatus(com.sequenceiq.freeipa.api.v1.operation.model.OperationStatus) SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) CleanupRequest(com.sequenceiq.freeipa.api.v1.freeipa.cleanup.CleanupRequest) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 13 with TestFailException

use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method addListDeleteDnsZonesBySubnet.

private void addListDeleteDnsZonesBySubnet(com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
    try {
        AddDnsZoneForSubnetsRequest request = new AddDnsZoneForSubnetsRequest();
        request.setSubnets(List.of("10.0.1.0/24", "192.168.1.0/24"));
        request.setEnvironmentCrn(environmentCrn);
        ipaClient.getDnsV1Endpoint().addDnsZoneForSubnets(request);
        /*          Until CB-15454 is fixed
            Set<String> dnsZones = ipaClient.getDnsV1Endpoint().listDnsZones(environmentCrn);
            Assertions.assertTrue(dnsZones.stream().anyMatch(dnsZone -> dnsZone.startsWith("1.0.10")));
            Assertions.assertTrue(dnsZones.stream().anyMatch(dnsZone -> dnsZone.startsWith("1.168.192")));*/
        ipaClient.getDnsV1Endpoint().deleteDnsZoneBySubnet(environmentCrn, "192.168.1.0/24");
        ipaClient.getDnsV1Endpoint().deleteDnsZoneBySubnet(environmentCrn, "10.0.1.0/24");
    /*            dnsZones = ipaClient.getDnsV1Endpoint().listDnsZones(environmentCrn);
            Assertions.assertFalse(dnsZones.stream().anyMatch(dnsZone -> dnsZone.startsWith("1.0.10")));
            Assertions.assertFalse(dnsZones.stream().anyMatch(dnsZone -> dnsZone.startsWith("1.168.192")));*/
    } catch (Exception e) {
        logger.error("DNS ZONE test failed during upgrade", e);
        throw new TestFailException("DNS ZONE test failed during upgrade with: " + e.getMessage(), e);
    }
}
Also used : AddDnsZoneForSubnetsRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsZoneForSubnetsRequest) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 14 with TestFailException

use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.

the class DistroXResilientScaleTests method removeInstanceWhileScalingGroup.

private DistroXTestDto removeInstanceWhileScalingGroup(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client, DistroXScaleTestParameters params) {
    CloudFunctionality cloudFunctionality = testContext.getCloudProvider().getCloudFunctionality();
    List<String> instancesToDelete = distroxUtil.getInstanceIds(testDto, client, params.getHostGroup()).stream().limit(getDeletionLimit(params)).collect(Collectors.toList());
    if (instancesToDelete.isEmpty()) {
        throw new TestFailException(String.format("At least 1 instance needed from '%s' group to delete!", params.getHostGroup()));
    }
    cloudFunctionality.deleteInstances(testDto.getName(), instancesToDelete);
    return testDto;
}
Also used : CloudFunctionality(com.sequenceiq.it.cloudbreak.util.CloudFunctionality) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 15 with TestFailException

use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.

the class SdxBackupRestoreTest method validateDatalakeBackupStatus.

private SdxInternalTestDto validateDatalakeBackupStatus(TestContext testContext, SdxInternalTestDto testDto, SdxClient client) {
    String sdxName = testDto.getName();
    backupId = client.getDefaultClient().sdxBackupEndpoint().getDatalakeBackupId(sdxName, null);
    SdxBackupStatusResponse sdxBackupStatusResponse = client.getDefaultClient().sdxBackupEndpoint().getBackupDatalakeStatus(sdxName, backupId, null);
    String status = sdxBackupStatusResponse.getStatus();
    String statusReason = sdxBackupStatusResponse.getReason();
    LOGGER.info(format(" SDX '%s' backup '%s' status '%s', because of %s ", sdxName, backupId, status, statusReason));
    if (status.contains("FAILED")) {
        LOGGER.error(String.format(" Sdx '%s' backup has been failed: '%s' ", testDto.getName(), statusReason));
        throw new TestFailException(String.format(" Sdx '%s' backup has been failed: '%s' ", testDto.getName(), statusReason));
    } else {
        LOGGER.info(String.format(" Sdx '%s' backup has been done with '%s'. ", testDto.getName(), statusReason));
        Log.then(LOGGER, format(" Sdx '%s' backup has been done with '%s'. ", testDto.getName(), statusReason));
    }
    return testDto;
}
Also used : SdxBackupStatusResponse(com.sequenceiq.sdx.api.model.SdxBackupStatusResponse) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Aggregations

TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)101 List (java.util.List)15 Inject (javax.inject.Inject)14 Map (java.util.Map)13 Description (com.sequenceiq.it.cloudbreak.context.Description)12 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)12 Logger (org.slf4j.Logger)12 LoggerFactory (org.slf4j.LoggerFactory)12 Test (org.testng.annotations.Test)12 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)10 WebApplicationException (javax.ws.rs.WebApplicationException)10 Log (com.sequenceiq.it.cloudbreak.log.Log)9 String.format (java.lang.String.format)9 Collectors (java.util.stream.Collectors)9 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)8 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)8 IOException (java.io.IOException)8 URISyntaxException (java.net.URISyntaxException)8 ArrayList (java.util.ArrayList)8 Set (java.util.Set)8