Search in sources :

Example 6 with MockOperatorCoordinatorContext

use of org.apache.flink.runtime.operators.coordination.MockOperatorCoordinatorContext in project flink by apache.

the class SourceCoordinatorProviderTest method testCallAsyncExceptionFailsJob.

@Test
public void testCallAsyncExceptionFailsJob() throws Exception {
    MockOperatorCoordinatorContext context = new MockOperatorCoordinatorContext(OPERATOR_ID, NUM_SPLITS);
    RecreateOnResetOperatorCoordinator coordinator = (RecreateOnResetOperatorCoordinator) provider.create(context);
    SourceCoordinator<?, ?> sourceCoordinator = (SourceCoordinator<?, ?>) coordinator.getInternalCoordinator();
    sourceCoordinator.getContext().callAsync(() -> null, (ignored, e) -> {
        throw new RuntimeException();
    });
    CommonTestUtils.waitUtil(context::isJobFailed, Duration.ofSeconds(10L), "The job did not fail before timeout.");
}
Also used : MockOperatorCoordinatorContext(org.apache.flink.runtime.operators.coordination.MockOperatorCoordinatorContext) RecreateOnResetOperatorCoordinator(org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator) Test(org.junit.Test)

Aggregations

MockOperatorCoordinatorContext (org.apache.flink.runtime.operators.coordination.MockOperatorCoordinatorContext)6 Test (org.junit.Test)5 OperatorCoordinator (org.apache.flink.runtime.operators.coordination.OperatorCoordinator)4 RecreateOnResetOperatorCoordinator (org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator)3 URLClassLoader (java.net.URLClassLoader)2 OperatorID (org.apache.flink.runtime.jobgraph.OperatorID)2 CompletableFuture (java.util.concurrent.CompletableFuture)1 ReaderRegistrationEvent (org.apache.flink.runtime.source.event.ReaderRegistrationEvent)1 Before (org.junit.Before)1