use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class UpgradeCcmOnFreeIpaHandlerTest method testFreeIpaMissingAvailabilityStatus.
@ParameterizedTest
@EnumSource(Status.class)
void testFreeIpaMissingAvailabilityStatus(Status status) {
DescribeFreeIpaResponse freeipa = new DescribeFreeIpaResponse();
freeipa.setStatus(status);
freeipa.setAvailabilityStatus(null);
Optional<DescribeFreeIpaResponse> freeipaOpt = Optional.of(freeipa);
when(freeIpaService.describe(any())).thenReturn(freeipaOpt);
underTest.accept(mockEnvironmentDtoEvent);
verify(freeIpaPollerService, never()).waitForCcmUpgrade(any(), any());
UpgradeCcmFailedEvent capturedUpgradeCcmEvent = (UpgradeCcmFailedEvent) baseNamedFlowEvent.getValue();
assertThat(capturedUpgradeCcmEvent.getResourceName()).isEqualTo(TEST_ENV_NAME);
assertThat(capturedUpgradeCcmEvent.getResourceId()).isEqualTo(TEST_ENV_ID);
assertThat(capturedUpgradeCcmEvent.getResourceCrn()).isEqualTo(TEST_ENV_CRN);
assertThat(capturedUpgradeCcmEvent.selector()).isEqualTo("FAILED_UPGRADE_CCM_EVENT");
assertThat(capturedUpgradeCcmEvent.getEnvironmentStatus()).isEqualTo(UPGRADE_CCM_ON_FREEIPA_FAILED);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaPollerProviderTest method testStopPoller.
@ParameterizedTest
@MethodSource("freeIpaStopStatuses")
void testStopPoller(Status s1Status, AttemptState attemptState, String message) throws Exception {
DescribeFreeIpaResponse stack1 = getDescribeFreeIpaResponse(s1Status, CRN);
when(freeIpaService.describe(CRN)).thenReturn(Optional.ofNullable(stack1));
AttemptResult<Void> result = underTest.stopPoller(ENV_ID, CRN).process();
Assertions.assertEquals(attemptState, result.getState());
Assertions.assertEquals(message, result.getMessage());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaPollerProviderTest method getDescribeFreeIpaResponse.
private DescribeFreeIpaResponse getDescribeFreeIpaResponse(Status status, String name) {
DescribeFreeIpaResponse stack1 = new DescribeFreeIpaResponse();
stack1.setStatus(status);
stack1.setName(name);
stack1.setCrn(name);
stack1.setStatusReason("reason");
return stack1;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaDeletionHandlerTest method shouldDetachChildEnvironmentIfParentExists.
@Test
public void shouldDetachChildEnvironmentIfParentExists() throws Exception {
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setId(CHILD_ENVIRONMENT_ID);
EnvironmentDeletionDto environmentDeletionDto = EnvironmentDeletionDto.builder().withEnvironmentDto(environmentDto).withForceDelete(true).withId(CHILD_ENVIRONMENT_ID).build();
when(environmentService.findEnvironmentById(CHILD_ENVIRONMENT_ID)).thenReturn(of(anEnvironmentWithParent(CHILD_ENVIRONMENT_ID)));
when(freeIpaService.describe(ENVIRONMENT_CRN)).thenReturn(of(new DescribeFreeIpaResponse()));
victim.accept(new Event<>(environmentDeletionDto));
ArgumentCaptor<DetachChildEnvironmentRequest> detachChildEnvironmentRequestArgumentCaptor = ArgumentCaptor.forClass(DetachChildEnvironmentRequest.class);
verify(freeIpaService).detachChildEnvironment(detachChildEnvironmentRequestArgumentCaptor.capture());
verifyNoMoreInteractions(freeIpaService);
verify(eventSender).sendEvent(any(BaseNamedFlowEvent.class), any(Event.Headers.class));
verify(dnsV1Endpoint).deleteDnsZoneBySubnet(eq(PARENT_ENVIRONMENT_CRN), any());
assertEquals(PARENT_ENVIRONMENT_CRN, detachChildEnvironmentRequestArgumentCaptor.getValue().getParentEnvironmentCrn());
assertEquals(ENVIRONMENT_CRN, detachChildEnvironmentRequestArgumentCaptor.getValue().getChildEnvironmentCrn());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class SdxCloudStorageTest method testSDXWithDataLakeAndFreeIpaStorageCanBeCreatedSuccessfully.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak", when = "a basic SDX create request with FreeIPA and DataLake Cloud Storage has been sent", then = "SDX should be available along with the created Cloud storage objects")
public void testSDXWithDataLakeAndFreeIpaStorageCanBeCreatedSuccessfully(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
DescribeFreeIpaResponse describeFreeIpaResponse = testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).getResponse();
testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, testDto, client) -> {
getCloudFunctionality(tc).cloudStorageListContainerDataLake(getBaseLocation(testDto), testDto.getResponse().getName(), testDto.getResponse().getStackCrn());
return testDto;
}).then((tc, testDto, client) -> {
getCloudFunctionality(tc).cloudStorageListContainerFreeIpa(getBaseLocation(testDto), describeFreeIpaResponse.getName(), describeFreeIpaResponse.getCrn());
return testDto;
}).validate();
}
Aggregations