zhuzhurk commented on a change in pull request #9904: [FLINK-14232][runtime] 
Support global failure handling in NG scheduling
URL: https://github.com/apache/flink/pull/9904#discussion_r338058224
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/failover/flip1/ExecutionFailureHandlerTest.java
 ##########
 @@ -167,23 +164,49 @@ public void testUnrecoverableErrorCheck() {
                        new Exception(new SuppressRestartsException(new 
Exception()))));
        }
 
+       @Test
+       public void testGlobalFailureHandling() {
+               final FailureHandlingResult result = 
executionFailureHandler.getGlobalFailureHandlingResult(
+                       new Exception("test failure"));
+
+               assertTrue(result.canRestart());
+               assertEquals(restartDelayMs, result.getRestartDelayMS());
+               assertEquals(
+                       
StreamSupport.stream(failoverTopology.getFailoverVertices().spliterator(), 
false)
+                       .map(FailoverVertex::getExecutionVertexID)
+                       .collect(Collectors.toSet()),
+                       result.getVerticesToRestart());
+               try {
+                       result.getError();
+                       fail("Cannot get error when the restarting is 
accepted");
+               } catch (IllegalStateException ex) {
+                       // expected
+               }
+       }
+
        // 
------------------------------------------------------------------------
        //  utilities
        // 
------------------------------------------------------------------------
 
        /**
-        * A FailoverStrategy implementation for tests. It always suggest 
restarting the given task set on construction.
+        * A FailoverStrategy implementation for tests. It always suggests 
restarting the given tasks to restart.
         */
        private class TestFailoverStrategy implements FailoverStrategy {
 
-               private final Set<ExecutionVertexID> tasksToRestart;
+               private Set<ExecutionVertexID> tasksToRestart;
 
-               public TestFailoverStrategy(Set<ExecutionVertexID> 
tasksToRestart) {
-                       this.tasksToRestart = checkNotNull(tasksToRestart);
+               public TestFailoverStrategy() {
+               }
+
+               public void setTasksToRestart(final Set<ExecutionVertexID> 
tasksToRestart) {
+                       this.tasksToRestart = tasksToRestart;
 
 Review comment:
   Ok. Will keep it as is since it is a private inner test class.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to