apalan60 commented on code in PR #20496:
URL: https://github.com/apache/kafka/pull/20496#discussion_r2333576169


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -2628,20 +2628,23 @@ class PlaintextAdminIntegrationTest extends 
BaseAdminIntegrationTest {
       val consumerGroupListing = new GroupListing(consumerGroupId, 
Optional.of(GroupType.CONSUMER), "consumer", Optional.of(GroupState.STABLE))
       val shareGroupListing = new GroupListing(shareGroupId, 
Optional.of(GroupType.SHARE), "share", Optional.of(GroupState.STABLE))
       val simpleGroupListing = new GroupListing(simpleGroupId, 
Optional.of(GroupType.CLASSIC), "", Optional.of(GroupState.EMPTY))
-      // Streams group could either be in STABLE or NOT_READY state
-      val streamsGroupListingStable = new GroupListing(streamsGroupId, 
Optional.of(GroupType.STREAMS), "streams", Optional.of(GroupState.STABLE))
-      val streamsGroupListingNotReady = new GroupListing(streamsGroupId, 
Optional.of(GroupType.STREAMS), "streams", Optional.of(GroupState.NOT_READY))
+      val streamsGroupListing = new GroupListing(streamsGroupId, 
Optional.of(GroupType.STREAMS), "streams", Optional.of(GroupState.STABLE))
 
       var listGroupsResult = client.listGroups()
       assertTrue(listGroupsResult.errors().get().isEmpty)
 
-      val expectedStreamListings = Set(streamsGroupListingStable, 
streamsGroupListingNotReady)
-      val expectedListings = Set(classicGroupListing, simpleGroupListing, 
consumerGroupListing, shareGroupListing)
-      val actualListings = listGroupsResult.all().get().asScala.toSet
-
-      // Check that actualListings contains all expectedListings and one of 
the streams listings
-      assertTrue(expectedListings.subsetOf(actualListings))
-      assertTrue(actualListings.exists(expectedStreamListings.contains))
+      TestUtils.waitUntilTrue(() => {
+        val listGroupResultScala = client.listGroups().all().get().asScala
+        val filteredStreamsGroups = listGroupResultScala.filter(_.groupId() == 
streamsGroupId)
+        val filteredClassicGroups = listGroupResultScala.filter(_.groupId() == 
classicGroupId)
+        val filteredConsumerGroups = listGroupResultScala.filter(_.groupId() 
== consumerGroupId)
+        val filteredShareGroups = listGroupResultScala.filter(_.groupId() == 
shareGroupId)
+        filteredClassicGroups.forall(_.groupState().orElse(null) == 
GroupState.STABLE) &&
+          filteredConsumerGroups.forall(_.groupState().orElse(null) == 
GroupState.STABLE) &&
+          filteredShareGroups.forall(_.groupState().orElse(null) == 
GroupState.STABLE) &&
+          filteredClassicGroups.forall(_.groupState().orElse(null) == 
GroupState.STABLE) &&

Review Comment:
   `filteredClassicGroups.forall(_.groupState().orElse(null) == 
GroupState.STABLE) &&`
   
   It looks like this line is duplicated.
   



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