use of org.apache.flink.util.FlinkException in project flink by apache.
the class JobMasterServiceLeadershipRunnerTest method testResultFutureCompletionOfOutdatedLeaderIsIgnored.
@Test
public void testResultFutureCompletionOfOutdatedLeaderIsIgnored() throws Exception {
final CompletableFuture<JobManagerRunnerResult> resultFuture = new CompletableFuture<>();
final JobMasterServiceLeadershipRunner jobManagerRunner = newJobMasterServiceLeadershipRunnerBuilder().withSingleJobMasterServiceProcess(TestingJobMasterServiceProcess.newBuilder().setJobManagerRunnerResultFuture(resultFuture).build()).build();
jobManagerRunner.start();
leaderElectionService.isLeader(UUID.randomUUID()).join();
leaderElectionService.notLeader();
resultFuture.complete(JobManagerRunnerResult.forSuccess(createFailedExecutionGraphInfo(new FlinkException("test exception"))));
assertThat(jobManagerRunner.getResultFuture(), willNotComplete(Duration.ofMillis(5L)));
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class JobResultTest method testCancelledJobThrowsJobCancellationException.
@Test
public void testCancelledJobThrowsJobCancellationException() throws Exception {
final FlinkException cause = new FlinkException("Test exception");
final JobResult jobResult = JobResult.createFrom(new ArchivedExecutionGraphBuilder().setJobID(new JobID()).setState(JobStatus.CANCELED).setFailureCause(new ErrorInfo(cause, 42L)).build());
try {
jobResult.toJobExecutionResult(getClass().getClassLoader());
fail("Job should fail with an JobCancellationException.");
} catch (JobCancellationException expected) {
// the failure cause in the execution graph should not be the cause of the canceled job
// result
assertThat(expected.getCause(), is(nullValue()));
}
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class JobResultTest method testFailedJobThrowsJobExecutionException.
@Test
public void testFailedJobThrowsJobExecutionException() throws Exception {
final FlinkException cause = new FlinkException("Test exception");
final JobResult jobResult = JobResult.createFrom(new ArchivedExecutionGraphBuilder().setJobID(new JobID()).setState(JobStatus.FAILED).setFailureCause(new ErrorInfo(cause, 42L)).build());
try {
jobResult.toJobExecutionResult(getClass().getClassLoader());
fail("Job should fail with JobExecutionException.");
} catch (JobExecutionException expected) {
assertThat(expected.getCause(), is(equalTo(cause)));
}
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class CreatingExecutionGraphTest method testSuspendTransitionsToFinished.
@Test
public void testSuspendTransitionsToFinished() throws Exception {
try (MockCreatingExecutionGraphContext context = new MockCreatingExecutionGraphContext()) {
final CreatingExecutionGraph creatingExecutionGraph = new CreatingExecutionGraph(context, new CompletableFuture<>(), log, CreatingExecutionGraphTest::createTestingOperatorCoordinatorHandler);
context.setExpectFinished(archivedExecutionGraph -> assertThat(archivedExecutionGraph.getState()).isEqualTo(JobStatus.SUSPENDED));
creatingExecutionGraph.suspend(new FlinkException("Job has been suspended."));
}
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class CreatingExecutionGraphTest method testGlobalFailureTransitionsToFinished.
@Test
public void testGlobalFailureTransitionsToFinished() throws Exception {
try (MockCreatingExecutionGraphContext context = new MockCreatingExecutionGraphContext()) {
final CreatingExecutionGraph creatingExecutionGraph = new CreatingExecutionGraph(context, new CompletableFuture<>(), log, CreatingExecutionGraphTest::createTestingOperatorCoordinatorHandler);
context.setExpectFinished(archivedExecutionGraph -> assertThat(archivedExecutionGraph.getState()).isEqualTo(JobStatus.FAILED));
creatingExecutionGraph.handleGlobalFailure(new FlinkException("Test exception"));
}
}
Aggregations