rkhachatryan commented on a change in pull request #14683:
URL: https://github.com/apache/flink/pull/14683#discussion_r559745525



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCleanerTest.java
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.checkpoint;
+
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.runtime.concurrent.Executors;
+import 
org.apache.flink.runtime.state.testutils.TestCompletedCheckpointStorageLocation;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.concurrent.ExecutorService;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static 
org.apache.flink.runtime.checkpoint.CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION;
+import static org.apache.flink.util.Preconditions.checkState;
+import static org.junit.Assert.assertTrue;
+
+public class CheckpointCleanerTest {
+
+    @Test
+    public void testTolerateFailureInPostCleanupSubmit() throws 
InterruptedException {
+        ExecutorService executor = 
java.util.concurrent.Executors.newSingleThreadExecutor();
+        CompletedCheckpoint checkpoint = createCheckpoint();
+        TestDiscardCallback discardCallback = new TestDiscardCallback();
+        checkpoint.setDiscardCallback(discardCallback);
+        new CheckpointsCleaner().cleanCheckpoint(checkpoint, true, 
executor::shutdownNow, executor);
+        checkState(executor.awaitTermination(10, SECONDS));
+        assertTrue(discardCallback.isDiscarded());
+    }
+
+    @Test
+    public void testTolerateFailureInPostCleanup() {
+        CompletedCheckpoint checkpoint = createCheckpoint();
+        TestDiscardCallback discardCallback = new TestDiscardCallback();
+        checkpoint.setDiscardCallback(discardCallback);
+        new CheckpointsCleaner()
+                .cleanCheckpoint(
+                    checkpoint,
+                        true,
+                        () -> {
+                            throw new RuntimeException();

Review comment:
       I guess it's the same discussion as 
[above](https://github.com/apache/flink/pull/14683#discussion_r559714220).




----------------------------------------------------------------
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


Reply via email to