use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.
the class SdxBackupRestoreTest method validateDatalakeRestoreStatus.
private SdxInternalTestDto validateDatalakeRestoreStatus(TestContext testContext, SdxInternalTestDto testDto, SdxClient client) {
String sdxName = testDto.getName();
String status;
String statusReason;
try {
restoreId = client.getDefaultClient().sdxRestoreEndpoint().getDatalakeRestoreId(sdxName, null);
SdxRestoreStatusResponse sdxRestoreStatusResponse = client.getDefaultClient().sdxRestoreEndpoint().getRestoreDatalakeStatus(sdxName, restoreId, null);
status = sdxRestoreStatusResponse.getStatus();
statusReason = sdxRestoreStatusResponse.getReason();
LOGGER.info(format(" SDX '%s' restore '%s' status '%s', because of %s ", sdxName, restoreId, status, statusReason));
} catch (Exception e) {
if (e.getMessage().contains("not found")) {
throw new TestFailException(String.format(" NOT FOUND :: Cannot get status information for restore '%s' on datalake '%s'." + " Please check the selected backup was successful and the related backup ID is correct. ", restoreId, testDto.getName()), e.getCause());
}
throw e;
}
if (StringUtils.isBlank(status)) {
LOGGER.error(String.format(" Sdx '%s' restore status is not available ", testDto.getName()));
throw new TestFailException(String.format(" Sdx '%s' restore status is not available ", testDto.getName()));
} else if (status.contains("FAILED")) {
LOGGER.error(String.format(" Sdx '%s' restore has been failed: '%s' ", testDto.getName(), statusReason));
throw new TestFailException(String.format(" Sdx '%s' restore has been failed: '%s' ", testDto.getName(), statusReason));
} else {
LOGGER.info(String.format(" Sdx '%s' restore has been done with '%s'. ", testDto.getName(), statusReason));
Log.then(LOGGER, format(" Sdx '%s' restore has been done with '%s'. ", testDto.getName(), statusReason));
}
return testDto;
}
use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.
the class MockSdxTests method validateSdxStatusReason.
private SdxTestDto validateSdxStatusReason(TestContext testContext, SdxTestDto testDto, SdxClient client) {
SdxClusterStatusResponse sdxStatus = testDto.getResponse().getStatus();
if (!SdxClusterStatusResponse.PROVISIONING_FAILED.equals(sdxStatus)) {
throw new TestFailException("Sdx status is not PROVISIONING_FAILED, current status: " + sdxStatus);
}
String statusReason = testDto.getResponse().getStatusReason();
if (!"Datalake creation failed. Invalid custom instance type for instance group: master - small".equals(statusReason)) {
throw new TestFailException("Sdx status reason is invalid: " + statusReason);
}
return testDto;
}
use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.
the class SdxRangerRazEnabledTests method testCreateSdxWithRangerRaz.
@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak", when = "enableRangerRaz is called when Raz is installed", then = "rangerRazEnabled is set for Sdx")
public void testCreateSdxWithRangerRaz(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(SdxTestDto.class).withExternalDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).withRangerRazEnabled(Boolean.TRUE).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().when(sdxTestClient.enableRangerRaz()).then((tc, testDto, client) -> {
final boolean rangerRazEnabled = testDto.getResponse().getRangerRazEnabled();
if (!rangerRazEnabled) {
throw new TestFailException("Ranger raz was not enabled!");
}
return testDto;
}).validate();
}
use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.
the class SdxResizeTests method validateShape.
private SdxInternalTestDto validateShape(SdxInternalTestDto dto) {
SdxClusterShape newShape = dto.getResponse().getClusterShape();
Log.log(LOGGER, format(" New shape: %s ", newShape.name()));
if (!SdxClusterShape.MEDIUM_DUTY_HA.equals(newShape)) {
throw new TestFailException(" The datalake shape is : " + newShape + " instead of: " + SdxClusterShape.MEDIUM_DUTY_HA.name());
}
return dto;
}
use of com.sequenceiq.it.cloudbreak.exception.TestFailException in project cloudbreak by hortonworks.
the class EnvironmentEditTest method authenticationEditWhenSetManagedKeyAndNotDeleteExisted.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running cloudbreak with existed ssh key", when = "change existing ssh key to managed one", then = "delete managed ssh key but not create new one")
public void authenticationEditWhenSetManagedKeyAndNotDeleteExisted(MockedTestContext testContext) {
String randomPublicKeyId = UUID.randomUUID().toString();
testContext.given(EnvironmentAuthenticationTestDto.class).withPublicKeyId(randomPublicKeyId).withPublicKey(null).given(EnvironmentTestDto.class).withCreateFreeIpa(false).when(environmentTestClient.create()).await(EnvironmentStatus.AVAILABLE).given(EnvironmentAuthenticationTestDto.class).withPublicKey(PUBLIC_KEY).withPublicKeyId(null).given(EnvironmentTestDto.class).when(environmentTestClient.changeAuthentication()).when(environmentTestClient.describe()).then((tc, t, c) -> {
String publicKeyId = t.getResponse().getAuthentication().getPublicKeyId();
String publicKey = t.getResponse().getAuthentication().getPublicKey();
if (randomPublicKeyId.equals(publicKeyId)) {
throw new TestFailException("The auth public key id was not changed, but it should be changed");
}
if (publicKey == null) {
throw new TestFailException("The auth public key should not be null");
}
return t;
}).validate();
}
Aggregations