You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by va...@apache.org on 2019/02/23 17:38:35 UTC
[kafka] branch 2.2 updated: KAFKA-7938: Fix test flakiness in
DeleteConsumerGroupsTest (#6312)
This is an automated email from the ASF dual-hosted git repository.
vahid 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 2a580ff KAFKA-7938: Fix test flakiness in DeleteConsumerGroupsTest (#6312)
2a580ff is described below
commit 2a580ff4fc2d9fcca0e197e49aa373c365c47d59
Author: Gwen (Chen) Shapira <cs...@gmail.com>
AuthorDate: Sat Feb 23 09:31:33 2019 -0800
KAFKA-7938: Fix test flakiness in DeleteConsumerGroupsTest (#6312)
(cherry picked from commit e82cc50ddb229a081787b920a8d27aea54f4bfd6)
---
.../kafka/admin/DeleteConsumerGroupsTest.scala | 32 ++++------------------
1 file changed, 5 insertions(+), 27 deletions(-)
diff --git a/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala b/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
index f24d8d1..1bcc316 100644
--- a/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
+++ b/core/src/test/scala/unit/kafka/admin/DeleteConsumerGroupsTest.scala
@@ -70,11 +70,11 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => {
- service.listGroups().contains(group)
+ service.collectGroupMembers(false)._2.get.size == 1
}, "The group did not initialize as expected.", maxRetries = 3)
val output = TestUtils.grabConsoleOutput(service.deleteGroups())
- assertTrue(s"The expected error (${Errors.NON_EMPTY_GROUP}) was not detected while deleting consumer group",
+ assertTrue(s"The expected error (${Errors.NON_EMPTY_GROUP}) was not detected while deleting consumer group. Output was: (${output})",
output.contains(s"Group '$group' could not be deleted due to:") && output.contains(Errors.NON_EMPTY_GROUP.message))
}
@@ -88,11 +88,12 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
val service = getConsumerGroupService(cgcArgs)
TestUtils.waitUntilTrue(() => {
- service.listGroups().contains(group)
+ service.collectGroupMembers(false)._2.get.size == 1
}, "The group did not initialize as expected.", maxRetries = 3)
val result = service.deleteGroups()
- assertTrue(s"The expected error (${Errors.NON_EMPTY_GROUP}) was not detected while deleting consumer group",
+ assertNotNull(s"Group was deleted successfully, but it shouldn't have been. Result was:(${result})", result.get(group).get)
+ assertTrue(s"The expected error (${Errors.NON_EMPTY_GROUP}) was not detected while deleting consumer group. Result was:(${result})",
result.size == 1 && result.keySet.contains(group) && result.get(group).get.getCause.isInstanceOf[GroupNotEmptyException])
}
@@ -199,29 +200,6 @@ class DeleteConsumerGroupsTest extends ConsumerGroupCommandTest {
result.keySet.contains(missingGroup) && result.get(missingGroup).get.getMessage.contains(Errors.GROUP_ID_NOT_FOUND.message))
}
- @Test
- def testDeleteCmdWithShortInitialization() {
- // run one consumer in the group
- addConsumerGroupExecutor(numConsumers = 1)
- val cgcArgs = Array("--bootstrap-server", brokerList, "--delete", "--group", group)
- val service = getConsumerGroupService(cgcArgs)
-
- val output = TestUtils.grabConsoleOutput(service.deleteGroups())
- assertTrue(s"The consumer group deletion did not work as expected",
- output.contains(s"Group '$group' could not be deleted due to"))
- }
-
- @Test
- def testDeleteWithShortInitialization() {
- // run one consumer in the group
- addConsumerGroupExecutor(numConsumers = 1)
- val cgcArgs = Array("--bootstrap-server", brokerList, "--delete", "--group", group)
- val service = getConsumerGroupService(cgcArgs)
-
- val result = service.deleteGroups()
- assertTrue(s"The consumer group deletion did not work as expected",
- result.size == 1 && result.keySet.contains(group))
- }
@Test(expected = classOf[OptionException])
def testDeleteWithUnrecognizedNewConsumerOption() {