dajac commented on code in PR #15237:
URL: https://github.com/apache/kafka/pull/15237#discussion_r1470772994


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupCoordinatorServiceTest.java:
##########
@@ -2056,4 +2059,70 @@ public void 
testCompleteTransactionWithUnexpectedPartition() {
 
         assertFutureThrows(future, IllegalStateException.class);
     }
+
+    @Test
+    public void testOnPartitionsDeleted() {
+        int partitionCount = 3;
+        CoordinatorRuntime<GroupCoordinatorShard, Record> runtime = 
mockRuntime();
+        GroupCoordinatorService service = new GroupCoordinatorService(
+            new LogContext(),
+            createConfig(),
+            runtime,
+            new GroupCoordinatorMetrics()
+        );
+
+        service.startup(() -> partitionCount);
+
+        when(runtime.partitions()).thenReturn(
+            IntStream
+                .range(0, partitionCount)
+                .mapToObj(i -> new TopicPartition("__consumer_offsets", i))
+                .collect(Collectors.toSet())
+        );
+
+        List<CompletableFuture<Void>> futures = IntStream
+            .range(0, partitionCount)
+            .mapToObj(__ -> new CompletableFuture<Void>())
+            .collect(Collectors.toList());
+
+        IntStream.range(0, partitionCount).forEach(i -> {
+            CompletableFuture<Void> future = futures.get(i);
+            when(runtime.scheduleWriteOperation(
+                ArgumentMatchers.eq("on-partition-deleted"),
+                ArgumentMatchers.eq(new TopicPartition("__consumer_offsets", 
i)),
+                ArgumentMatchers.eq(Duration.ofMillis(5000)),
+                ArgumentMatchers.any()
+            )).thenAnswer(__ -> future);
+        });
+
+        IntStream.range(0, partitionCount - 1).forEach(i -> {

Review Comment:
   Yes. You got it right.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to