use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithValidEngDestination.
@Test
void testWithValidEngDestination() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.ENG);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
FeaturesResponse features = new FeaturesResponse();
FeatureSetting featureSetting = new FeatureSetting();
featureSetting.setEnabled(true);
features.setClusterLogsCollection(featureSetting);
telemetry.setFeatures(features);
stackV4Response.setTelemetry(telemetry);
underTest.validate(request, stackV4Response);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithCloudStorageWithDisabledLogging.
@Test
void testWithCloudStorageWithDisabledLogging() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
stackV4Response.setTelemetry(telemetry);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("Cloud storage logging is disabled for Data Lake"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithEngDestinationAndDisabledLogCollection.
@Test
void testWithEngDestinationAndDisabledLogCollection() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.ENG);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
stackV4Response.setTelemetry(telemetry);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("Cluster log collection is not enabled for Data Lake"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DistroXCreateAction method action.
@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
if (StringUtils.isEmpty(testDto.getRequest().getEnvironmentName())) {
Log.when(LOGGER, " Env name cannot be null ");
throw new TestFailException("Env name cannot be null");
}
Log.whenJson(LOGGER, " Distrox create request: ", testDto.getRequest());
StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().post(testDto.getRequest());
testDto.setFlow("Distrox create", stackV4Response.getFlowIdentifier());
testDto.setResponse(stackV4Response);
Log.whenJson(LOGGER, " Distrox create response: ", stackV4Response);
return testDto;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DistroXRemoveInstancesAction method action.
@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
List<String> removableInstanceIds = testDto.getInstanceIdsForAction();
if (!removableInstanceIds.isEmpty()) {
MultipleInstanceDeleteRequest instanceDeleteRequest = new MultipleInstanceDeleteRequest();
instanceDeleteRequest.setInstances(removableInstanceIds);
Log.when(LOGGER, String.format(" Removing instances [%s] from distrox '%s'... ", instanceDeleteRequest.getInstances(), testDto.getName()));
FlowIdentifier flowIdentifier = client.getDefaultClient().distroXV1Endpoint().deleteInstancesByCrn(testDto.getCrn(), removableInstanceIds, instanceDeleteRequest, false);
testDto.setFlow("Instance deletion", flowIdentifier);
StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), new HashSet<>(Arrays.asList("hardware_info", "events")));
testDto.setResponse(stackV4Response);
Log.whenJson(LOGGER, " Distrox remove instances response: ", stackV4Response);
LOGGER.info(String.format("Hardware info for distrox '%s' after remove instances [%s].", testDto.getName(), stackV4Response.getHardwareInfoGroups()));
return testDto;
} else {
throw new TestFailException(String.format("Cannot find any instance to remove from distrox '%s'!", testDto.getName()));
}
}
Aggregations