use of org.apache.flink.runtime.highavailability.JobResultEntry in project flink by apache.
the class DispatcherResourceCleanupTest method testErrorHandlingIfJobCannotBeMarkedAsCleanInJobResultStore.
@Test
public void testErrorHandlingIfJobCannotBeMarkedAsCleanInJobResultStore() throws Exception {
final CompletableFuture<JobResultEntry> dirtyJobFuture = new CompletableFuture<>();
final JobResultStore jobResultStore = TestingJobResultStore.builder().withCreateDirtyResultConsumer(dirtyJobFuture::complete).withMarkResultAsCleanConsumer(jobId -> {
throw new IOException("Expected IOException.");
}).build();
final TestingJobManagerRunnerFactory jobManagerRunnerFactory = startDispatcherAndSubmitJob(createTestingDispatcherBuilder().setJobResultStore(jobResultStore), 0);
ArchivedExecutionGraph executionGraph = new ArchivedExecutionGraphBuilder().setJobID(jobId).setState(JobStatus.FINISHED).build();
final TestingJobManagerRunner testingJobManagerRunner = jobManagerRunnerFactory.takeCreatedJobManagerRunner();
testingJobManagerRunner.completeResultFuture(new ExecutionGraphInfo(executionGraph));
final CompletableFuture<? extends Throwable> errorFuture = this.testingFatalErrorHandlerResource.getFatalErrorHandler().getErrorFuture();
try {
final Throwable unexpectedError = errorFuture.get(100, TimeUnit.MILLISECONDS);
fail("No error should have been reported but an " + unexpectedError.getClass() + " was handled.");
} catch (TimeoutException e) {
// expected
}
assertThat(dirtyJobFuture.get().getJobId(), is(jobId));
}
Aggregations