This is an automated email from the ASF dual-hosted git repository.
ijuma pushed a commit to branch 2.2
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.2 by this push:
new 9d71c2f KAFKA-8245: Fix Flaky Test
DeleteConsumerGroupsTest#testDeleteCmdAllGroups (#8032) (#8243)
9d71c2f is described below
commit 9d71c2f373e51dc8caf4308eef4d37ece3c899b4
Author: Vikas Singh <[email protected]>
AuthorDate: Mon Mar 9 06:35:23 2020 -0700
KAFKA-8245: Fix Flaky Test DeleteConsumerGroupsTest#testDeleteCmdAllGroups
(#8032) (#8243)
Change unit tests to make sure the consumer group is in Stable state (i.e.
consumers have completed joining the group)
(cherry picked from commit 350dce865ae5420a25496bc502c55de4c15bf71e)
Reviewers: Ismael Juma <[email protected]>
Co-authored-by: Chia-Ping Tsai <[email protected]>
---
.../scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git
a/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
b/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
index 1bcc316..1d59a6e 100644
--- a/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
+++ b/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
@@ -107,7 +107,7 @@ class DeleteConsumerGroupsTest extends
ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => {
- service.listGroups().contains(group)
+ service.listGroups().contains(group) &&
service.collectGroupState().state == "Stable"
}, "The group did not initialize as expected.", maxRetries = 3)
executor.shutdown()
@@ -122,7 +122,7 @@ class DeleteConsumerGroupsTest extends
ConsumerGroupCommandTest {
}
@Test
- def testDeleteEmptyGroup() {
+ def testDeleteEmptyGroup(): Unit = {
TestUtils.createOffsetsTopic(zkClient, servers)
// run one consumer in the group
@@ -131,7 +131,7 @@ class DeleteConsumerGroupsTest extends
ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => {
- service.listGroups().contains(group)
+ service.listGroups().contains(group) &&
service.collectGroupState().state == "Stable"
}, "The group did not initialize as expected.", maxRetries = 3)
executor.shutdown()
@@ -156,7 +156,7 @@ class DeleteConsumerGroupsTest extends
ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => {
- service.listGroups().contains(group)
+ service.listGroups().contains(group) &&
service.collectGroupState().state == "Stable"
}, "The group did not initialize as expected.", maxRetries = 3)
executor.shutdown()
@@ -183,7 +183,7 @@ class DeleteConsumerGroupsTest extends
ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => {
- service.listGroups().contains(group)
+ service.listGroups().contains(group) &&
service.collectGroupState().state == "Stable"
}, "The group did not initialize as expected.", maxRetries = 3)
executor.shutdown()
@@ -196,8 +196,8 @@ class DeleteConsumerGroupsTest extends
ConsumerGroupCommandTest {
val result = service2.deleteGroups()
assertTrue(s"The consumer group deletion did not work as expected",
result.size == 2 &&
- result.keySet.contains(group) && result.get(group).get == null &&
- result.keySet.contains(missingGroup) &&
result.get(missingGroup).get.getMessage.contains(Errors.GROUP_ID_NOT_FOUND.message))
+ result.keySet.contains(group) && result(group) == null &&
+ result.keySet.contains(missingGroup) &&
result(missingGroup).getMessage.contains(Errors.GROUP_ID_NOT_FOUND.message))
}