jolshan commented on code in PR #12853:
URL: https://github.com/apache/kafka/pull/12853#discussion_r1036316154
##########
core/src/test/scala/unit/kafka/coordinator/group/GroupCoordinatorAdapterTest.scala:
##########
@@ -135,4 +134,48 @@ class GroupCoordinatorAdapterTest {
assertEquals(expectedData, future.get())
}
+ @Test
+ def testListGroups(): Unit = {
+ testListGroups(null, Set.empty)
+ testListGroups(List(), Set.empty)
+ testListGroups(List("Stable"), Set("Stable"))
+ }
+
+ def testListGroups(
+ statesFilter: List[String],
+ expectedStatesFilter: Set[String]
+ ): Unit = {
+ val groupCoordinator = mock(classOf[GroupCoordinator])
+ val adapter = new GroupCoordinatorAdapter(groupCoordinator)
+
+ val ctx = makeContext(ApiKeys.LIST_GROUPS.latestVersion)
+ val data = new ListGroupsRequestData()
+ .setStatesFilter(statesFilter.asJava)
+
+ when(groupCoordinator.handleListGroups(expectedStatesFilter)).thenReturn {
+ (Errors.NOT_COORDINATOR, List(
+ GroupOverview("group1", "protocol1", "Stable"),
+ GroupOverview("group2", "qwerty", "Empty")
Review Comment:
Hmm I think I'm a bit confused by your last sentence.
But to clarify my understanding -- this filtering is done within the
handleListGroups method, but since this test is mocking the result we don't
actually filter the groups?
And the different filters at the top are just really checking the empty
state filter is tested correctly?
--
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]