use of com.sequenceiq.environment.util.PollingConfig in project cloudbreak by hortonworks.
the class SdxDeleteServiceTest method deleteSdxClustersForEnvironmentFail.
@Test
void deleteSdxClustersForEnvironmentFail() {
PollingConfig pollingConfig = getPollingConfig();
EnvironmentView environment = getEnvironmentView();
String sdxCrn1 = "crn:cdp:datalake:us-west-1:tenant:datalake:crn1";
String sdxCrn2 = "crn:cdp:sdxsvc:us-west-1:tenant:instance:crn2";
when(environmentResourceDeletionService.getAttachedSdxClusterCrns(environment)).thenReturn(Set.of(sdxCrn1, sdxCrn2));
when(platformAwareSdxConnector.getAttemptResultForDeletion(any(), any(), any())).thenReturn(AttemptResults.breakFor(new IllegalStateException()));
assertThatThrownBy(() -> underTest.deleteSdxClustersForEnvironment(pollingConfig, environment, true)).isInstanceOf(UserBreakException.class).hasCauseInstanceOf(IllegalStateException.class);
verify(platformAwareSdxConnector).delete(eq(sdxCrn1), eq(true));
verify(platformAwareSdxConnector).delete(eq(sdxCrn2), eq(true));
verifyNoMoreInteractions(platformAwareSdxConnector);
}
use of com.sequenceiq.environment.util.PollingConfig in project cloudbreak by hortonworks.
the class SdxDeleteServiceTest method deleteSdxClustersForEnvironmentNoSdxFound.
@Test
void deleteSdxClustersForEnvironmentNoSdxFound() {
PollingConfig pollingConfig = getPollingConfig();
EnvironmentView environment = getEnvironmentView();
when(environmentResourceDeletionService.getAttachedSdxClusterCrns(environment)).thenReturn(Set.of());
underTest.deleteSdxClustersForEnvironment(pollingConfig, environment, true);
}
use of com.sequenceiq.environment.util.PollingConfig in project cloudbreak by hortonworks.
the class DatahubDeletionServiceTest method deleteDatahubClustersForEnvironmentNoDatahubFound.
@Test
void deleteDatahubClustersForEnvironmentNoDatahubFound() {
PollingConfig pollingConfig = PollingConfig.builder().withSleepTime(0).withSleepTimeUnit(TimeUnit.SECONDS).withTimeout(0).withTimeoutTimeUnit(TimeUnit.SECONDS).build();
Environment environment = new Environment();
environment.setResourceCrn(ENV_CRN);
StackViewV4Responses responses = new StackViewV4Responses(Set.of());
when(datahubService.list(anyString())).thenReturn(responses);
underTest.deleteDatahubClustersForEnvironment(pollingConfig, environment, true);
verify(datahubService, never()).deleteMultiple(anyString(), any(), anyBoolean());
}
use of com.sequenceiq.environment.util.PollingConfig in project cloudbreak by hortonworks.
the class SdxDeleteServiceTest method deleteSdxClustersForEnvironmentWhenSdxIsEmptyButDatalakeNot.
@Test
void deleteSdxClustersForEnvironmentWhenSdxIsEmptyButDatalakeNot() {
PollingConfig pollingConfig = getPollingConfig();
EnvironmentView environment = getEnvironmentView();
when(environmentResourceDeletionService.getAttachedSdxClusterCrns(environment)).thenReturn(emptySet());
when(environmentResourceDeletionService.getDatalakeClusterNames(environment)).thenReturn(Set.of("name"));
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
when(stackV4Endpoint.list(anyLong(), anyString(), anyBoolean())).thenReturn(new StackViewV4Responses());
underTest.deleteSdxClustersForEnvironment(pollingConfig, environment, true);
verify(stackV4Endpoint).deleteInternal(eq(0L), eq("name"), eq(true), nullable(String.class));
}
use of com.sequenceiq.environment.util.PollingConfig in project cloudbreak by hortonworks.
the class SdxDeleteServiceTest method deleteSdxClustersForEnvironment.
@Test
void deleteSdxClustersForEnvironment() {
PollingConfig pollingConfig = getPollingConfig();
EnvironmentView environment = getEnvironmentView();
String sdxCrn1 = "crn:cdp:datalake:us-west-1:tenant:datalake:crn1";
String sdxCrn2 = "crn:cdp:sdxsvc:us-west-1:tenant:instance:crn2";
when(environmentResourceDeletionService.getAttachedSdxClusterCrns(environment)).thenReturn(Set.of(sdxCrn1, sdxCrn2));
when(platformAwareSdxConnector.getAttemptResultForDeletion(any(), any(), any())).thenReturn(AttemptResults.finishWith(null));
underTest.deleteSdxClustersForEnvironment(pollingConfig, environment, true);
verify(platformAwareSdxConnector).delete(eq(sdxCrn1), eq(true));
verify(platformAwareSdxConnector).delete(eq(sdxCrn2), eq(true));
verifyNoMoreInteractions(platformAwareSdxConnector);
}
Aggregations