use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method testGlobalFailureBeforeCheckpointResetsToEmptyState.
@Test
public void testGlobalFailureBeforeCheckpointResetsToEmptyState() throws Exception {
final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
failGlobalAndRestart(scheduler, new TestException());
assertSame("coordinator should have null restored state", TestingOperatorCoordinator.NULL_RESTORE_VALUE, coordinator.getLastRestoredCheckpointState());
assertEquals(OperatorCoordinator.NO_CHECKPOINT, coordinator.getLastRestoredCheckpointId());
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method testDeliveringClientRequestToNonExistingCoordinator.
@Test
public void testDeliveringClientRequestToNonExistingCoordinator() throws Exception {
final OperatorCoordinator.Provider provider = new TestingOperatorCoordinator.Provider(testOperatorId);
final DefaultScheduler scheduler = createScheduler(provider);
final String payload = "testing payload";
final TestingCoordinationRequestHandler.Request<String> request = new TestingCoordinationRequestHandler.Request<>(payload);
CommonTestUtils.assertThrows("does not exist", FlinkException.class, () -> scheduler.deliverCoordinationRequestToCoordinator(new OperatorID(), request));
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method testDeliveringClientRequestToNonRequestHandler.
@Test
public void testDeliveringClientRequestToNonRequestHandler() throws Exception {
final OperatorCoordinator.Provider provider = new TestingOperatorCoordinator.Provider(testOperatorId);
final DefaultScheduler scheduler = createScheduler(provider);
final String payload = "testing payload";
final TestingCoordinationRequestHandler.Request<String> request = new TestingCoordinationRequestHandler.Request<>(payload);
CommonTestUtils.assertThrows("cannot handle client event", FlinkException.class, () -> scheduler.deliverCoordinationRequestToCoordinator(testOperatorId, request));
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method testSavepointRestoresCoordinator.
@Test
public void testSavepointRestoresCoordinator() throws Exception {
final byte[] testCoordinatorState = new byte[123];
new Random().nextBytes(testCoordinatorState);
final DefaultScheduler scheduler = createSchedulerWithRestoredSavepoint(testCoordinatorState);
final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
final byte[] restoredState = coordinator.getLastRestoredCheckpointState();
assertArrayEquals(testCoordinatorState, restoredState);
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method createSchedulerAndDeployTasks.
private DefaultScheduler createSchedulerAndDeployTasks(OperatorCoordinator.Provider provider) throws Exception {
final DefaultScheduler scheduler = setupTestJobAndScheduler(provider);
scheduleAllTasksToRunning(scheduler);
return scheduler;
}
Aggregations