use of org.apache.flink.runtime.resourcemanager.TestingResourceManagerFactory in project flink by apache.
the class ClusterEntrypointTest method testCloseAsyncShouldNotDeregisterApp.
@Test
public void testCloseAsyncShouldNotDeregisterApp() throws Exception {
final CompletableFuture<Void> deregisterFuture = new CompletableFuture<>();
final TestingResourceManagerFactory testingResourceManagerFactory = new TestingResourceManagerFactory.Builder().setInternalDeregisterApplicationConsumer((ignored1, ignored2, ignore3) -> deregisterFuture.complete(null)).build();
final TestingEntryPoint testingEntryPoint = new TestingEntryPoint.Builder().setConfiguration(flinkConfig).setResourceManagerFactory(testingResourceManagerFactory).build();
final CompletableFuture<ApplicationStatus> appStatusFuture = startClusterEntrypoint(testingEntryPoint);
testingEntryPoint.closeAsync();
assertThat(appStatusFuture.get(TIMEOUT_MS, TimeUnit.MILLISECONDS), is(ApplicationStatus.UNKNOWN));
assertThat(deregisterFuture.isDone(), is(false));
}
use of org.apache.flink.runtime.resourcemanager.TestingResourceManagerFactory in project flink by apache.
the class ClusterEntrypointTest method testClusterFinishedNormallyShouldDeregisterAppAndCleanupHAData.
@Test
public void testClusterFinishedNormallyShouldDeregisterAppAndCleanupHAData() throws Exception {
final CompletableFuture<Void> deregisterFuture = new CompletableFuture<>();
final CompletableFuture<Void> closeAndCleanupAllDataFuture = new CompletableFuture<>();
final CompletableFuture<ApplicationStatus> dispatcherShutDownFuture = new CompletableFuture<>();
final HighAvailabilityServices testingHaService = new TestingHighAvailabilityServicesBuilder().setCloseAndCleanupAllDataFuture(closeAndCleanupAllDataFuture).build();
final TestingResourceManagerFactory testingResourceManagerFactory = new TestingResourceManagerFactory.Builder().setInternalDeregisterApplicationConsumer((ignored1, ignored2, ignore3) -> deregisterFuture.complete(null)).setInitializeConsumer((ignore) -> dispatcherShutDownFuture.complete(ApplicationStatus.SUCCEEDED)).build();
final TestingDispatcherRunnerFactory testingDispatcherRunnerFactory = new TestingDispatcherRunnerFactory.Builder().setShutDownFuture(dispatcherShutDownFuture).build();
final TestingEntryPoint testingEntryPoint = new TestingEntryPoint.Builder().setConfiguration(flinkConfig).setResourceManagerFactory(testingResourceManagerFactory).setDispatcherRunnerFactory(testingDispatcherRunnerFactory).setHighAvailabilityServices(testingHaService).build();
final CompletableFuture<ApplicationStatus> appStatusFuture = startClusterEntrypoint(testingEntryPoint);
assertThat(appStatusFuture.get(TIMEOUT_MS, TimeUnit.MILLISECONDS), is(ApplicationStatus.SUCCEEDED));
assertThat(deregisterFuture.isDone(), is(true));
assertThat(closeAndCleanupAllDataFuture.isDone(), is(true));
}
Aggregations