metaswirl commented on a change in pull request #18637:
URL: https://github.com/apache/flink/pull/18637#discussion_r800801786



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/cleanup/DefaultResourceCleanerTest.java
##########
@@ -181,33 +212,97 @@ public void 
testMediumPriorityCleanupBlocksAllLowerPrioritizedCleanups() {
         assertThat(noPriorityCleanup1.isDone()).isTrue();
     }
 
+    @Test
+    public void testCleanupWithRetries() {
+        final Collection<JobID> actualJobIds = new ArrayList<>();
+        final CleanupCallback cleanupWithRetries = 
cleanupWithRetry(actualJobIds, 2);
+        final SingleCallCleanup oneRunCleanup = 
SingleCallCleanup.withCompletionOnCleanup();
+
+        final CompletableFuture<Void> compositeCleanupResult =
+                createTestInstanceBuilder(new FixedRetryStrategy(2, 
Duration.ZERO))
+                        .withRegularCleanup(cleanupWithRetries)
+                        .withRegularCleanup(oneRunCleanup)
+                        .build()
+                        .cleanupAsync(JOB_ID);
+
+        
assertThat(compositeCleanupResult).succeedsWithin(Duration.ofMillis(100));
+
+        assertThat(oneRunCleanup.getProcessedJobId()).isEqualTo(JOB_ID);
+        assertThat(oneRunCleanup.isDone()).isTrue();
+        assertThat(actualJobIds).containsExactly(JOB_ID, JOB_ID, JOB_ID);
+    }
+
+    @Test
+    public void testCleanupWithSingleRetryInHighPriorityTask() {
+        final Collection<JobID> actualJobIds = new ArrayList<>();
+        final CleanupCallback cleanupWithRetry = 
cleanupWithRetry(actualJobIds, 1);
+        final SingleCallCleanup oneRunCleanup = 
SingleCallCleanup.withCompletionOnCleanup();
+
+        final CompletableFuture<Void> compositeCleanupResult =
+                createTestInstanceBuilder(new FixedRetryStrategy(1, 
Duration.ZERO))
+                        .withPrioritizedCleanup(cleanupWithRetry)

Review comment:
       How about we add a second prio cleanup here, to show that the second 
cleanup is executed a single time, even if the first prio cleanup retries.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to