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();
}
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();
}
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;
}
Aggregations