tweise commented on a change in pull request #6567: [FLINK-10074] Allowable 
number of checkpoint failures
URL: https://github.com/apache/flink/pull/6567#discussion_r213180551
 
 

 ##########
 File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/CheckpointExceptionHandlerTest.java
 ##########
 @@ -49,6 +49,59 @@ public void testRethrowingHandler() {
                Assert.assertNull(environment.getLastDeclinedCheckpointCause());
        }
 
+       @Test
+       public void testRethrowingHandlerWithTolerableNumberTriggered() {
+               DeclineDummyEnvironment environment = new 
DeclineDummyEnvironment();
+               
environment.getExecutionConfig().setTaskTolerableCheckpointFailuresNumber(3);
+               CheckpointExceptionHandlerFactory 
checkpointExceptionHandlerFactory = new CheckpointExceptionHandlerFactory();
+               CheckpointExceptionHandler exceptionHandler =
+                       
checkpointExceptionHandlerFactory.createCheckpointExceptionHandler(true, 
environment);
+
+               CheckpointMetaData failedCheckpointMetaData = new 
CheckpointMetaData(42L, 4711L);
+               Exception testException = new Exception("test");
+               try {
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+                       failedCheckpointMetaData = new CheckpointMetaData(43L, 
4711L);
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+                       failedCheckpointMetaData = new CheckpointMetaData(44L, 
4711L);
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+                       failedCheckpointMetaData = new CheckpointMetaData(45L, 
4711L);
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+
+                       Assert.fail("Exception not rethrown.");
+               } catch (Exception e) {
+                       Assert.assertEquals(testException, e);
+               }
+
+               Assert.assertNull(environment.getLastDeclinedCheckpointCause());
+       }
+
+       @Test
+       public void testRethrowingHandlerWithTolerableNumberNotTriggered() {
+               DeclineDummyEnvironment environment = new 
DeclineDummyEnvironment();
+               
environment.getExecutionConfig().setTaskTolerableCheckpointFailuresNumber(3);
+               CheckpointExceptionHandlerFactory 
checkpointExceptionHandlerFactory = new CheckpointExceptionHandlerFactory();
+               CheckpointExceptionHandler exceptionHandler =
+                       
checkpointExceptionHandlerFactory.createCheckpointExceptionHandler(true, 
environment);
+
+               CheckpointMetaData failedCheckpointMetaData = new 
CheckpointMetaData(42L, 4711L);
+               Exception testException = new Exception("test");
+
+               try {
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+                       failedCheckpointMetaData = new CheckpointMetaData(43L, 
4711L);
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+                       failedCheckpointMetaData = new CheckpointMetaData(44L, 
4711L);
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+                       failedCheckpointMetaData = new CheckpointMetaData(46L, 
4711L);
+                       
exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, 
testException);
+               } catch (Exception e) {
+                       Assert.assertNotEquals(testException, e);
 
 Review comment:
   Shouldn't this fail since we don't expect an exception?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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