use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.FAILED in project cloudbreak by hortonworks.
the class DatabaseConfigServiceTest method testTestNewConnectionFails.
@Test
public void testTestNewConnectionFails() {
DatabaseConfig newConfig = new DatabaseConfig();
doAnswer((Answer) invocation -> {
MapBindingResult errors = invocation.getArgument(1, MapBindingResult.class);
errors.addError(new ObjectError("failed", ERROR_MESSAGE));
return null;
}).when(connectionValidator).validate(any(), any());
String result = underTest.testConnection(newConfig);
assertEquals(ERROR_MESSAGE, result);
verify(connectionValidator).validate(eq(newConfig), any());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.FAILED in project cloudbreak by hortonworks.
the class DatabaseConfigServiceTest method testRegisterConnectionFailure.
@Test
public void testRegisterConnectionFailure() {
thrown.expect(IllegalArgumentException.class);
DatabaseConfig configToRegister = new DatabaseConfig();
configToRegister.setConnectionDriver("org.postgresql.MyCustomDriver");
doAnswer((Answer) invocation -> {
MapBindingResult errors = invocation.getArgument(1, MapBindingResult.class);
errors.addError(new ObjectError("failed", ERROR_MESSAGE));
return null;
}).when(connectionValidator).validate(any(), any());
underTest.register(configToRegister, true);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.FAILED in project cloudbreak by hortonworks.
the class AwsSdxSpotInstanceTest method testSdxOnSpotInstances.
@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running cloudbreak ", when = "creating an SDX with 100% spot percentage ", then = "SDX is started on spot instances, or fails with insufficient spot capacity")
public void testSdxOnSpotInstances(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest database = new SdxDatabaseRequest();
database.setCreate(false);
testContext.given(SdxTestDto.class).withCloudStorage().withExternalDatabase(database).withSpotPercentage(100).when(sdxTestClient.create(), key(sdx)).then((tc, testDto, client) -> {
testDto.await(STACK_CREATED, key(sdx));
Map<String, Exception> exceptionMap = testContext.getExceptionMap();
if (!exceptionMap.isEmpty()) {
String key = testDto.getAwaitExceptionKey(STACK_CREATED);
if (exceptionMap.containsKey(key)) {
LOGGER.info("Awaiting STACK_CREATED failed, clearing exception to check status reason", exceptionMap.get(key));
exceptionMap.remove(key);
}
}
return testDto;
}).when(sdxTestClient.describe()).then(assertSpotInstances()).validate();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.FAILED in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method dnsLookups.
private void dnsLookups(SdxTestDto sdxTestDto, SdxClient sdxClient) {
InstanceMetaDataV4Response instanceGroupMetadata = getInstanceGroups(sdxTestDto, sdxClient).stream().flatMap(instanceGroup -> instanceGroup.getMetadata().stream()).filter(metadata -> metadata.getInstanceGroup().equals("idbroker")).filter(metadata -> StringUtils.isNoneBlank(metadata.getDiscoveryFQDN(), metadata.getPrivateIp())).findFirst().orElseThrow(() -> new TestFailException("FreeIPA upgrade DNS lookups test failed, idbroker instance group was not found."));
try {
String cmd = String.format(CHECK_DNS_LOOKUPS_CMD, instanceGroupMetadata.getDiscoveryFQDN(), instanceGroupMetadata.getPrivateIp());
Map<String, Pair<Integer, String>> results = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(sdxTestDto, sdxClient), List.of(HostGroupType.MASTER.getName()), cmd, false);
results.values().forEach(result -> Assertions.assertEquals(0, result.getLeft()));
} catch (Exception e) {
logger.error("FreeIPA upgrade DNS lookups test failed with unexpected error", e);
throw new TestFailException("FreeIPA upgrade DNS lookups test failed with unexpected error: " + e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.FAILED in project cloudbreak by hortonworks.
the class SdxUpgradeRecoveryService method validateRecovery.
public SdxRecoverableResponse validateRecovery(SdxCluster sdxCluster) {
MDCBuilder.buildMdcContext(sdxCluster);
try {
String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
RecoveryValidationV4Response response = ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint.getClusterRecoverableByNameInternal(0L, sdxCluster.getClusterName(), initiatorUserCrn));
return new SdxRecoverableResponse(response.getReason(), response.getStatus());
} catch (WebApplicationException e) {
String exceptionMessage = exceptionMessageExtractor.getErrorMessage(e);
String message = String.format("Stack recovery validation failed on cluster: [%s]. Message: [%s]", sdxCluster.getClusterName(), exceptionMessage);
throw new CloudbreakApiException(message, e);
}
}
Aggregations