Browse Source

KAFKA-8245: Fix Flaky Test DeleteConsumerGroupsTest#testDeleteCmdAllGroups (#8032)

Change unit tests to make sure the consumer group is in Stable state (i.e. consumers have completed joining the group)
pull/8131/head
Chia-Ping Tsai 5 years ago committed by GitHub
parent
commit
413db69d41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala

11
core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala

@ -107,7 +107,7 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs) val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => { TestUtils.waitUntilTrue(() => {
service.listGroups().contains(group) service.listGroups().contains(group) && service.collectGroupState(group).state == "Stable"
}, "The group did not initialize as expected.") }, "The group did not initialize as expected.")
executor.shutdown() executor.shutdown()
@ -137,7 +137,8 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs) val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => { TestUtils.waitUntilTrue(() => {
service.listGroups().forall(groupId => groups.keySet.contains(groupId)) service.listGroups().toSet == groups.keySet &&
groups.keySet.forall(groupId => service.collectGroupState(groupId).state == "Stable")
}, "The group did not initialize as expected.") }, "The group did not initialize as expected.")
// Shutdown consumers to empty out groups // Shutdown consumers to empty out groups
@ -168,7 +169,7 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs) val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => { TestUtils.waitUntilTrue(() => {
service.listGroups().contains(group) service.listGroups().contains(group) && service.collectGroupState(group).state == "Stable"
}, "The group did not initialize as expected.") }, "The group did not initialize as expected.")
executor.shutdown() executor.shutdown()
@ -193,7 +194,7 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs) val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => { TestUtils.waitUntilTrue(() => {
service.listGroups().contains(group) service.listGroups().contains(group) && service.collectGroupState(group).state == "Stable"
}, "The group did not initialize as expected.") }, "The group did not initialize as expected.")
executor.shutdown() executor.shutdown()
@ -220,7 +221,7 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs) val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => { TestUtils.waitUntilTrue(() => {
service.listGroups().contains(group) service.listGroups().contains(group) && service.collectGroupState(group).state == "Stable"
}, "The group did not initialize as expected.") }, "The group did not initialize as expected.")
executor.shutdown() executor.shutdown()

Loading…
Cancel
Save