You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/23 16:37:59 UTC

[GitHub] [kafka] OmniaGM commented on a diff in pull request #12858: KAFKA-14367; Add `DeleteGroups` to the new `GroupCoordinator` interface

OmniaGM commented on code in PR #12858:
URL: https://github.com/apache/kafka/pull/12858#discussion_r1030666809


##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -1992,6 +1992,186 @@ class KafkaApisTest {
     testListOffsetFailedGetLeaderReplica(Errors.UNKNOWN_TOPIC_OR_PARTITION)
   }
 
+  @Test
+  def testHandleDeleteGroups(): Unit = {
+    val deleteGroupsRequest = new DeleteGroupsRequestData()
+      .setGroupsNames(List(
+        "group-1",
+        "group-2",
+        "group-3"
+      ).asJava)
+
+    val requestChannelRequest = buildRequest(new DeleteGroupsRequest.Builder(deleteGroupsRequest).build())
+
+    val expectedRequestContext = new GroupCoordinatorRequestContext(
+      ApiKeys.DELETE_GROUPS.latestVersion,
+      requestChannelRequest.context.clientId,
+      requestChannelRequest.context.clientAddress,
+      RequestLocal.NoCaching.bufferSupplier
+    )
+
+    val future = new CompletableFuture[DeleteGroupsResponseData.DeletableGroupResultCollection]()
+    when(newGroupCoordinator.deleteGroups(
+      ArgumentMatchers.eq(expectedRequestContext),
+      ArgumentMatchers.eq(List("group-1", "group-2", "group-3").asJava)
+    )).thenReturn(future)
+
+    createKafkaApis().handleDeleteGroupsRequest(
+      requestChannelRequest,
+      RequestLocal.NoCaching
+    )
+
+    val results = new DeleteGroupsResponseData.DeletableGroupResultCollection(List(

Review Comment:
   One small suggestion here. It seems like we initialize `List[DeletableGroupResult]` for these test cases here so maybe to simplify the test code a bit we can have a method that converts `Map[String, Errors]` (where group id is the key) into `List[DeletableGroupResult]`. 



-- 
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-unsubscribe@kafka.apache.org

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