use of org.apache.flink.runtime.webmonitor.TestingDispatcherGateway in project flink by apache.
the class SessionDispatcherLeaderProcessTest method confirmLeaderSessionFuture_completesAfterDispatcherServiceHasBeenStarted.
@Test
public void confirmLeaderSessionFuture_completesAfterDispatcherServiceHasBeenStarted() throws Exception {
final OneShotLatch createDispatcherServiceLatch = new OneShotLatch();
final String dispatcherAddress = "myAddress";
final TestingDispatcherGateway dispatcherGateway = TestingDispatcherGateway.newBuilder().setAddress(dispatcherAddress).build();
dispatcherServiceFactory = createFactoryBasedOnGenericSupplier(() -> {
try {
createDispatcherServiceLatch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return TestingDispatcherGatewayService.newBuilder().setDispatcherGateway(dispatcherGateway).build();
});
try (final SessionDispatcherLeaderProcess dispatcherLeaderProcess = createDispatcherLeaderProcess()) {
final CompletableFuture<String> confirmLeaderSessionFuture = dispatcherLeaderProcess.getLeaderAddressFuture();
dispatcherLeaderProcess.start();
assertThat(confirmLeaderSessionFuture).isNotDone();
createDispatcherServiceLatch.trigger();
assertThat(confirmLeaderSessionFuture).succeedsWithin(100, TimeUnit.MILLISECONDS).isEqualTo(dispatcherAddress);
}
}
use of org.apache.flink.runtime.webmonitor.TestingDispatcherGateway in project flink by apache.
the class SessionDispatcherLeaderProcessTest method onAddedJobGraph_failingRecoveredJobSubmission_failsFatally.
@Test
public void onAddedJobGraph_failingRecoveredJobSubmission_failsFatally() throws Exception {
final TestingDispatcherGateway dispatcherGateway = TestingDispatcherGateway.newBuilder().setSubmitFunction(jobGraph -> FutureUtils.completedExceptionally(new JobSubmissionException(jobGraph.getJobID(), "test exception"))).build();
runOnAddedJobGraphTest(dispatcherGateway, this::verifyOnAddedJobGraphResultFailsFatally);
}
use of org.apache.flink.runtime.webmonitor.TestingDispatcherGateway in project flink by apache.
the class SessionDispatcherLeaderProcessTest method onAddedJobGraph_duplicateJobSubmissionDueToFalsePositive_willBeIgnored.
@Test
public void onAddedJobGraph_duplicateJobSubmissionDueToFalsePositive_willBeIgnored() throws Exception {
final TestingDispatcherGateway dispatcherGateway = TestingDispatcherGateway.newBuilder().setSubmitFunction(jobGraph -> FutureUtils.completedExceptionally(DuplicateJobSubmissionException.of(jobGraph.getJobID()))).build();
runOnAddedJobGraphTest(dispatcherGateway, this::verifyOnAddedJobGraphResultDidNotFail);
}
Aggregations