flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/FailoverRegionTest.java
/**
	 * Tests that a new failure comes while the failover region is restarting
	 * @throws Exception
	 */
Tests that a new failure comes while the failover region is restarting
@throws Exception
Tests that a new failure comes while the failover region is restarting @throws Exception
@Test
	public void testFailWhileRestarting() throws Exception {
		RestartStrategy restartStrategy = new InfiniteDelayRestartStrategy();
		ExecutionGraph eg = createSingleRegionExecutionGraph(restartStrategy);
		RestartPipelinedRegionStrategy strategy = (RestartPipelinedRegionStrategy)eg.getFailoverStrategy();
		Iterator<ExecutionVertex> iter = eg.getAllExecutionVertices().iterator();
		ExecutionVertex ev1 = iter.next();
		assertEquals(JobStatus.RUNNING, strategy.getFailoverRegion(ev1).getState());
		ev1.getCurrentExecutionAttempt().fail(new Exception("new fail"));
		assertEquals(JobStatus.CANCELLING, strategy.getFailoverRegion(ev1).getState());
		for (ExecutionVertex evs : eg.getAllExecutionVertices()) {
			evs.getCurrentExecutionAttempt().cancelingComplete();
		}
		assertEquals(JobStatus.RUNNING, strategy.getFailoverRegion(ev1).getState());
		ev1.getCurrentExecutionAttempt().fail(new Exception("new fail"));
		assertEquals(JobStatus.CANCELLING, strategy.getFailoverRegion(ev1).getState());
	}
@ Test public void testFailWhileRestarting ( ) throws Exception { RestartStrategy restartStrategy = new InfiniteDelayRestartStrategy ( ) ; ExecutionGraph eg = createSingleRegionExecutionGraph ( restartStrategy ) ; RestartPipelinedRegionStrategy strategy = ( RestartPipelinedRegionStrategy ) eg . getFailoverStrategy ( ) ; Iterator < ExecutionVertex > iter = eg . getAllExecutionVertices ( ) . iterator ( ) ; ExecutionVertex ev1 = iter . next ( ) ; assertEquals ( JobStatus . RUNNING , strategy . getFailoverRegion ( ev1 ) . getState ( ) ) ; ev1 . getCurrentExecutionAttempt ( ) . fail ( new Exception ( "new fail" ) ) ; assertEquals ( JobStatus . CANCELLING , strategy . getFailoverRegion ( ev1 ) . getState ( ) ) ; for ( ExecutionVertex evs : eg . getAllExecutionVertices ( ) ) { evs . getCurrentExecutionAttempt ( ) . cancelingComplete ( ) ; } assertEquals ( JobStatus . RUNNING , strategy . getFailoverRegion ( ev1 ) . getState ( ) ) ; ev1 . getCurrentExecutionAttempt ( ) . fail ( new Exception ( "new fail" ) ) ; assertEquals ( JobStatus . CANCELLING , strategy . getFailoverRegion ( ev1 ) . getState ( ) ) ; }
Tests that a new failure comes while the failover region is restarting
 @throws Exception
Tests that a new failure comes while the failover region is restarting @throws Exception