use of org.apache.flink.util.concurrent.TestingUncaughtExceptionHandler in project flink by apache.
the class RobustActorSystemTest method setup.
@Before
public void setup() {
testingUncaughtExceptionHandler = new TestingUncaughtExceptionHandler();
robustActorSystem = RobustActorSystem.create("testSystem", AkkaUtils.getForkJoinExecutorConfig(RpcUtils.getTestForkJoinExecutorConfiguration()), testingUncaughtExceptionHandler);
}
use of org.apache.flink.util.concurrent.TestingUncaughtExceptionHandler in project flink by apache.
the class StreamTaskTest method testUncaughtExceptionInAsynchronousCheckpointingOperation.
/**
* Tests that uncaught exceptions in the async part of a checkpoint operation are forwarded to
* the uncaught exception handler. See <a
* href="https://issues.apache.org/jira/browse/FLINK-12889">FLINK-12889</a>.
*/
@Test
public void testUncaughtExceptionInAsynchronousCheckpointingOperation() throws Exception {
final RuntimeException failingCause = new RuntimeException("Test exception");
FailingDummyEnvironment failingDummyEnvironment = new FailingDummyEnvironment(failingCause);
// mock the returned snapshots
OperatorSnapshotFutures operatorSnapshotResult = new OperatorSnapshotFutures(ExceptionallyDoneFuture.of(failingCause), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()));
final TestingUncaughtExceptionHandler uncaughtExceptionHandler = new TestingUncaughtExceptionHandler();
RunningTask<MockStreamTask> task = runTask(() -> new MockStreamTask(failingDummyEnvironment, operatorChain(streamOperatorWithSnapshot(operatorSnapshotResult)), uncaughtExceptionHandler));
MockStreamTask streamTask = task.streamTask;
waitTaskIsRunning(streamTask, task.invocationFuture);
streamTask.triggerCheckpointAsync(new CheckpointMetaData(42L, 1L), CheckpointOptions.forCheckpointWithDefaultLocation());
final Throwable uncaughtException = uncaughtExceptionHandler.waitForUncaughtException();
assertThat(uncaughtException, is(failingCause));
streamTask.finishInput();
task.waitForTaskCompletion(false);
}
Aggregations