use of org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult in project flink by splunk.
the class FailureHandlingResultSnapshotTest method testGlobalFailureHandlingResultSnapshotCreation.
@Test
public void testGlobalFailureHandlingResultSnapshotCreation() {
final Throwable rootCause = new FlinkException("Expected exception: root cause");
final long timestamp = System.currentTimeMillis();
final ExecutionVertex failedExecutionVertex0 = extractExecutionVertex(0);
final Throwable failure0 = new RuntimeException("Expected exception: failure #0");
final ExecutionVertex failedExecutionVertex1 = extractExecutionVertex(1);
final Throwable failure1 = new IllegalStateException("Expected exception: failure #1");
triggerFailure(failedExecutionVertex0, failure0);
triggerFailure(failedExecutionVertex1, failure1);
final FailureHandlingResult failureHandlingResult = FailureHandlingResult.restartable(null, rootCause, timestamp, StreamSupport.stream(executionGraph.getAllExecutionVertices().spliterator(), false).map(ExecutionVertex::getID).collect(Collectors.toSet()), 0L, true);
final FailureHandlingResultSnapshot testInstance = FailureHandlingResultSnapshot.create(failureHandlingResult, this::getLatestExecution);
assertThat(testInstance.getRootCause(), is(rootCause));
assertThat(testInstance.getTimestamp(), is(timestamp));
assertThat(testInstance.getRootCauseExecution().isPresent(), is(false));
assertThat(testInstance.getConcurrentlyFailedExecution(), IsIterableContainingInAnyOrder.containsInAnyOrder(failedExecutionVertex0.getCurrentExecutionAttempt(), failedExecutionVertex1.getCurrentExecutionAttempt()));
}
Aggregations