Search in sources :

Example 1 with FreeIpaTestDto

use of com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method testHAFreeIpaInstanceUpgrade.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running cloudbreak", when = "a valid stack create request is sent with 3 FreeIPA instances " + "AND the stack is upgraded one node at a time", then = "the stack should be available AND deletable")
public void testHAFreeIpaInstanceUpgrade(TestContext testContext) {
    String freeIpa = resourcePropertyProvider().getName();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    sdxDatabaseRequest.setCreate(false);
    testContext.given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(freeIpa, FreeIpaTestDto.class).withFreeIpaHa(1, 3).withTelemetry("telemetry").withUpgradeCatalogAndImage().when(freeIpaTestClient.create(), key(freeIpa)).await(FREEIPA_AVAILABLE).given(SdxTestDto.class).withCloudStorage().withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create()).await(SdxClusterStatusResponse.RUNNING).given(freeIpa, FreeIpaTestDto.class).when(freeIpaTestClient.upgrade()).await(Status.UPDATE_IN_PROGRESS, waitForFlow().withWaitForFlow(Boolean.FALSE)).given(FreeIpaOperationStatusTestDto.class).withOperationId(((FreeIpaTestDto) testContext.get(freeIpa)).getOperationId()).then((tc, testDto, freeIpaClient) -> testFreeIpaAvailabilityDuringUpgrade(tc, testDto, freeIpaClient, freeIpa)).await(COMPLETED, waitForFlow().withWaitForFlow(Boolean.FALSE).withTimeoutChecker(new AbsolutTimeBasedTimeoutChecker(TWO_HOURS_IN_SEC))).given(freeIpa, FreeIpaTestDto.class).await(FREEIPA_AVAILABLE, waitForFlow().withWaitForFlow(Boolean.FALSE)).then((tc, testDto, client) -> freeIpaTestClient.delete().action(tc, testDto, client)).await(FREEIPA_DELETE_COMPLETED, waitForFlow().withWaitForFlow(Boolean.FALSE)).validate();
}
Also used : AbsolutTimeBasedTimeoutChecker(com.sequenceiq.cloudbreak.polling.AbsolutTimeBasedTimeoutChecker) TelemetryTestDto(com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) 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)

Example 2 with FreeIpaTestDto

use of com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method testSingleFreeIpaInstanceUpgrade.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running cloudbreak", when = "a valid stack create request is sent with 1 FreeIPA instances " + "AND the stack is upgraded one node at a time", then = "the stack should be available AND deletable")
public void testSingleFreeIpaInstanceUpgrade(TestContext testContext) {
    String freeIpa = resourcePropertyProvider().getName();
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    sdxDatabaseRequest.setCreate(false);
    testContext.given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(freeIpa, FreeIpaTestDto.class).withTelemetry("telemetry").withUpgradeCatalogAndImage().when(freeIpaTestClient.create(), key(freeIpa)).await(FREEIPA_AVAILABLE).given(SdxTestDto.class).withCloudStorage().withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create()).await(SdxClusterStatusResponse.RUNNING).given(freeIpa, FreeIpaTestDto.class).when(freeIpaTestClient.upgrade()).await(Status.UPDATE_IN_PROGRESS, waitForFlow().withWaitForFlow(Boolean.FALSE)).given(FreeIpaOperationStatusTestDto.class).withOperationId(((FreeIpaTestDto) testContext.get(freeIpa)).getOperationId()).then((tc, testDto, freeIpaClient) -> testFreeIpaAvailabilityDuringUpgrade(tc, testDto, freeIpaClient, freeIpa)).await(COMPLETED).given(freeIpa, FreeIpaTestDto.class).await(FREEIPA_AVAILABLE, waitForFlow().withWaitForFlow(Boolean.FALSE)).then((tc, testDto, client) -> freeIpaTestClient.delete().action(tc, testDto, client)).await(FREEIPA_DELETE_COMPLETED, waitForFlow().withWaitForFlow(Boolean.FALSE)).validate();
}
Also used : SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) 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)

Example 3 with FreeIpaTestDto

use of com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method testFreeIpaAvailabilityDuringUpgrade.

private FreeIpaOperationStatusTestDto testFreeIpaAvailabilityDuringUpgrade(TestContext testContext, FreeIpaOperationStatusTestDto testDto, FreeIpaClient freeIpaClient, String freeIpa) {
    try {
        com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient = freeIpaClient.getDefaultClient();
        FreeIpaTestDto freeIpaTestDto = testContext.get(freeIpa);
        String environmentCrn = freeIpaTestDto.getResponse().getEnvironmentCrn();
        String accountId = Crn.safeFromString(environmentCrn).getAccountId();
        boolean firstTestFailure = true;
        while (ipaClient.getOperationV1Endpoint().getOperationStatus(testDto.getOperationId(), accountId).getStatus() == RUNNING) {
            try {
                addAndDeleteDnsARecord(ipaClient, environmentCrn);
                addAndDeleteDnsCnameRecord(ipaClient, environmentCrn);
                addListDeleteDnsZonesBySubnet(ipaClient, environmentCrn);
                createBindUser(testContext, ipaClient, environmentCrn);
                generateHostKeyTab(ipaClient, environmentCrn);
                generateServiceKeytab(ipaClient, environmentCrn);
                dnsLookups(testContext.given(SdxTestDto.class), testContext.getSdxClient());
                cleanUp(testContext, ipaClient, environmentCrn);
                kinit(testContext.given(SdxTestDto.class), testContext.getSdxClient(), ipaClient, environmentCrn);
                syncUsers(testContext, ipaClient, environmentCrn, accountId);
            } catch (TestFailException e) {
                if (firstTestFailure) {
                    logger.info("First test failure is ignored until CB-15454 is fixed");
                    firstTestFailure = false;
                } else {
                    throw e;
                }
            }
        }
    } catch (TestFailException e) {
        throw e;
    } catch (Exception e) {
        logger.error("Unexpected error during FreeIPA upgrade availability test", e);
        throw new TestFailException("Unexpected error during FreeIPA upgrade availability test: " + e.getMessage(), e);
    }
    return testDto;
}
Also used : SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Aggregations

FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)3 Description (com.sequenceiq.it.cloudbreak.context.Description)2 AbstractE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)2 SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)2 Test (org.testng.annotations.Test)2 AbsolutTimeBasedTimeoutChecker (com.sequenceiq.cloudbreak.polling.AbsolutTimeBasedTimeoutChecker)1 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)1 TelemetryTestDto (com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto)1 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)1 WebApplicationException (javax.ws.rs.WebApplicationException)1