FrankYang0529 commented on code in PR #15908:
URL: https://github.com/apache/kafka/pull/15908#discussion_r1625866331


##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/DescribeConsumerGroupTest.java:
##########
@@ -141,699 +186,857 @@ public void testPrintVersion(String quorum) {
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeOffsetsOfNonExistingGroup(String quorum, String 
groupProtocol) throws Exception {
-        String group = "missing.group";
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(1, groupProtocol);
-        // note the group to be queried is a different (non-existing) group
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(group);
-        assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.DEAD)).orElse(false) && 
res.getValue().map(Collection::isEmpty).orElse(false),
-            "Expected the state to be 'Dead', with no members in the group '" 
+ group + "'.");
-    }
-
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeMembersOfNonExistingGroup(String quorum, String 
groupProtocol) throws Exception {
-        String group = "missing.group";
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(1, groupProtocol);
-        // note the group to be queried is a different (non-existing) group
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, false);
-        assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.DEAD)).orElse(false) && 
res.getValue().map(Collection::isEmpty).orElse(false),
-            "Expected the state to be 'Dead', with no members in the group '" 
+ group + "'.");
-
-        Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res2 = 
service.collectGroupMembers(group, true);
-        assertTrue(res2.getKey().map(s -> 
s.equals(ConsumerGroupState.DEAD)).orElse(false) && 
res2.getValue().map(Collection::isEmpty).orElse(false),
-            "Expected the state to be 'Dead', with no members in the group '" 
+ group + "' (verbose option).");
-    }
-
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeStateOfNonExistingGroup(String quorum, String 
groupProtocol) throws Exception {
-        String group = "missing.group";
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(1, groupProtocol);
-        // note the group to be queried is a different (non-existing) group
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        GroupState state = service.collectGroupState(group);
-        assertTrue(Objects.equals(state.state, ConsumerGroupState.DEAD) && 
state.numMembers == 0 &&
-                state.coordinator != null && !brokers().filter(s -> 
s.config().brokerId() == state.coordinator.id()).isEmpty(),
-            "Expected the state to be 'Dead', with no members in the group '" 
+ group + "'."
-        );
-    }
-
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeExistingGroup(String quorum, String groupProtocol) 
throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
+    @ClusterTemplate("generator")
+    public void testDescribeOffsetsOfNonExistingGroup() throws Exception {
+        String missingGroup = "missing.group";
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            String group = GROUP + String.join("", describeType);
             // run one consumer in the group consuming from a single-partition 
topic
-            addConsumerGroupExecutor(1, TOPIC, group, groupProtocol);
-            List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group));
-            cgcArgs.addAll(describeType);
-            ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs.toArray(new String[0]));
-
-            TestUtils.waitForCondition(() -> {
-                Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
-                return res.getKey().trim().split("\n").length == 2 && 
res.getValue().isEmpty();
-            }, "Expected a data row and no error in describe results with 
describe type " + String.join(" ", describeType) + ".");
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 // note the group to be queried is a different (non-existing) 
group
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", missingGroup});
+            ) {
+                Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(missingGroup);
+                assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.DEAD)).orElse(false) && 
res.getValue().map(Collection::isEmpty).orElse(false),
+                        "Expected the state to be 'Dead', with no members in 
the group '" + missingGroup + "'.");
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeExistingGroups(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // Create N single-threaded consumer groups from a single-partition 
topic
-        List<String> groups = new ArrayList<>();
-
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            String group = GROUP + String.join("", describeType);
-            addConsumerGroupExecutor(1, TOPIC, group, groupProtocol);
-            groups.addAll(Arrays.asList("--group", group));
+    @ClusterTemplate("generator")
+    public void testDescribeMembersOfNonExistingGroup() throws Exception {
+        String missingGroup = "missing.group";
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 // note the group to be queried is a different (non-existing) 
group
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", missingGroup});
+            ) {
+                Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(missingGroup, false);
+                assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.DEAD)).orElse(false) && 
res.getValue().map(Collection::isEmpty).orElse(false),
+                        "Expected the state to be 'Dead', with no members in 
the group '" + missingGroup + "'.");
+
+                Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res2 = 
service.collectGroupMembers(missingGroup, true);
+                assertTrue(res2.getKey().map(s -> 
s.equals(ConsumerGroupState.DEAD)).orElse(false) && 
res2.getValue().map(Collection::isEmpty).orElse(false),
+                        "Expected the state to be 'Dead', with no members in 
the group '" + missingGroup + "' (verbose option).");
+            }
         }
+    }
 
-        int expectedNumLines = DESCRIBE_TYPES.size() * 2;
-
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
bootstrapServers(listenerName()), "--describe"));
-            cgcArgs.addAll(groups);
-            cgcArgs.addAll(describeType);
-            ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs.toArray(new String[0]));
-
-            TestUtils.waitForCondition(() -> {
-                Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
-                long numLines = 
Arrays.stream(res.getKey().trim().split("\n")).filter(line -> 
!line.isEmpty()).count();
-                return (numLines == expectedNumLines) && 
res.getValue().isEmpty();
-            }, "Expected a data row and no error in describe results with 
describe type " + String.join(" ", describeType) + ".");
+    @ClusterTemplate("generator")
+    public void testDescribeStateOfNonExistingGroup() throws Exception {
+        String missingGroup = "missing.group";
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 // note the group to be queried is a different (non-existing) 
group
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", missingGroup});
+            ) {
+                GroupState state = service.collectGroupState(missingGroup);
+                assertTrue(Objects.equals(state.state, 
ConsumerGroupState.DEAD) && state.numMembers == 0 &&
+                                state.coordinator != null && 
clusterInstance.brokerIds().contains(state.coordinator.id()),
+                        "Expected the state to be 'Dead', with no members in 
the group '" + missingGroup + "'."
+                );
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeAllExistingGroups(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // Create N single-threaded consumer groups from a single-partition 
topic
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            String group = GROUP + String.join("", describeType);
-            addConsumerGroupExecutor(1, TOPIC, group, groupProtocol);
+    @ClusterTemplate("generator")
+    public void testDescribeExistingGroup() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            createTopic(topic);
+            for (List<String> describeType : DESCRIBE_TYPES) {
+                String protocolGroup = GROUP_PREFIX + groupProtocol.name() + 
"." + String.join("", describeType);
+                try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, protocolGroup, topic, 
Collections.emptyMap());
+                     ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", protocolGroup});
+                ) {
+                    TestUtils.waitForCondition(() -> {
+                        Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
+                        return res.getKey().trim().split("\n").length == 2 && 
res.getValue().isEmpty();
+                    }, "Expected a data row and no error in describe results 
with describe type " + String.join(" ", describeType) + ".");
+                }
+            }
         }
+    }
 
-        int expectedNumLines = DESCRIBE_TYPES.size() * 2;
-
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--all-groups"));
-            cgcArgs.addAll(describeType);
-            ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs.toArray(new String[0]));
+    @ClusterTemplate("generator")
+    public void testDescribeExistingGroups() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-            TestUtils.waitForCondition(() -> {
-                Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
-                long numLines = 
Arrays.stream(res.getKey().trim().split("\n")).filter(s -> 
!s.isEmpty()).count();
-                return (numLines == expectedNumLines) && 
res.getValue().isEmpty();
-            }, "Expected a data row and no error in describe results with 
describe type " + String.join(" ", describeType) + ".");
+            // Create N single-threaded consumer groups from a 
single-partition topic
+            List<AutoCloseable> protocolConsumerGroupExecutors = new 
ArrayList<>();
+            try {
+                List<String> groups = new ArrayList<>();
+                for (List<String> describeType : DESCRIBE_TYPES) {
+                    String group = GROUP_PREFIX + groupProtocol.name() + "." + 
String.join("", describeType);
+                    AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                    groups.addAll(Arrays.asList("--group", group));
+                    
protocolConsumerGroupExecutors.add(protocolConsumerGroupExecutor);
+                }
+
+                int expectedNumLines = DESCRIBE_TYPES.size() * 2;
+
+                for (List<String> describeType : DESCRIBE_TYPES) {
+                    List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe"));
+                    cgcArgs.addAll(groups);
+                    cgcArgs.addAll(describeType);
+                    try (ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(cgcArgs.toArray(new String[0]));) {
+                        TestUtils.waitForCondition(() -> {
+                            Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
+                            long numLines = 
Arrays.stream(res.getKey().trim().split("\n")).filter(line -> 
!line.isEmpty()).count();
+                            return (numLines == expectedNumLines) && 
res.getValue().isEmpty();
+                        }, "Expected a data row and no error in describe 
results with describe type " + String.join(" ", describeType) + ".");
+                    }
+                }
+            } finally {
+                for (AutoCloseable protocolConsumerGroupExecutor : 
protocolConsumerGroupExecutors) {
+                    protocolConsumerGroupExecutor.close();
+                }
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeOffsetsOfExistingGroup(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(1, groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> groupOffsets = 
service.collectGroupOffsets(GROUP);
-            Optional<ConsumerGroupState> state = groupOffsets.getKey();
-            Optional<Collection<PartitionAssignmentState>> assignments = 
groupOffsets.getValue();
+    @ClusterTemplate("generator")
+    public void testDescribeAllExistingGroups() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-            Predicate<PartitionAssignmentState> isGrp = s -> 
Objects.equals(s.group, GROUP);
-
-            boolean res = state.map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
-                assignments.isPresent() &&
-                assignments.get().stream().filter(isGrp).count() == 1;
-
-            if (!res)
-                return false;
-
-            Optional<PartitionAssignmentState> maybePartitionState = 
assignments.get().stream().filter(isGrp).findFirst();
-            if (!maybePartitionState.isPresent())
-                return false;
-
-            PartitionAssignmentState partitionState = 
maybePartitionState.get();
-
-            return !partitionState.consumerId.map(s0 -> 
s0.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) &&
-                !partitionState.clientId.map(s0 -> 
s0.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) &&
-                !partitionState.host.map(h -> 
h.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false);
-        }, "Expected a 'Stable' group status, rows and valid values for 
consumer id / client id / host columns in describe results for group " + GROUP 
+ ".");
+            // Create N single-threaded consumer groups from a 
single-partition topic
+            List<AutoCloseable> protocolConsumerGroupExecutors = new 
ArrayList<>();
+            try {
+                List<String> groups = new ArrayList<>();
+                for (List<String> describeType : DESCRIBE_TYPES) {
+                    String group = GROUP_PREFIX + groupProtocol.name() + "." + 
String.join("", describeType);
+                    groups.add(group);
+                    AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                    
protocolConsumerGroupExecutors.add(protocolConsumerGroupExecutor);
+                }
+                int expectedNumLines = DESCRIBE_TYPES.size() * 2;
+                for (List<String> describeType : DESCRIBE_TYPES) {
+                    try (ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--all-groups"});) {
+                        TestUtils.waitForCondition(() -> {
+                            Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
+                            long numLines = 
Arrays.stream(res.getKey().trim().split("\n")).filter(line -> 
!line.isEmpty()).count();
+                            return (numLines == expectedNumLines) && 
res.getValue().isEmpty();
+                        }, "Expected a data row and no error in describe 
results with describe type " + String.join(" ", describeType) + ".");
+                    }
+                }
+
+                for (AutoCloseable protocolConsumerGroupExecutor : 
protocolConsumerGroupExecutors) {
+                    protocolConsumerGroupExecutor.close();
+                }
+                deleteConsumerGroups(groups);
+                deleteTopic(topic);
+            } finally {
+                for (AutoCloseable protocolConsumerGroupExecutor : 
protocolConsumerGroupExecutors) {
+                    protocolConsumerGroupExecutor.close();
+                }
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeMembersOfExistingGroup(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(1, groupProtocol);
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
+    @ClusterTemplate("generator")
+    public void testDescribeOffsetsOfExistingGroup() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> groupMembers = 
service.collectGroupMembers(GROUP, false);
-            Optional<ConsumerGroupState> state = groupMembers.getKey();
-            Optional<Collection<MemberAssignmentState>> assignments = 
groupMembers.getValue();
-
-            Predicate<MemberAssignmentState> isGrp = s -> 
Objects.equals(s.group, GROUP);
-
-            boolean res = state.map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
-                assignments.isPresent() &&
-                assignments.get().stream().filter(s -> Objects.equals(s.group, 
GROUP)).count() == 1;
+            // run one consumer in the group consuming from a single-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> groupOffsets = 
service.collectGroupOffsets(group);
+                    Optional<ConsumerGroupState> state = groupOffsets.getKey();
+                    Optional<Collection<PartitionAssignmentState>> assignments 
= groupOffsets.getValue();
 
-            if (!res)
-                return false;
+                    Predicate<PartitionAssignmentState> isGrp = s -> 
Objects.equals(s.group, group);
 
-            Optional<MemberAssignmentState> maybeAssignmentState = 
assignments.get().stream().filter(isGrp).findFirst();
-            if (!maybeAssignmentState.isPresent())
-                return false;
+                    boolean res = state.map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
+                            assignments.isPresent() &&
+                            assignments.get().stream().filter(isGrp).count() 
== 1;
 
-            MemberAssignmentState assignmentState = maybeAssignmentState.get();
+                    if (!res)
+                        return false;
 
-            return !Objects.equals(assignmentState.consumerId, 
ConsumerGroupCommand.MISSING_COLUMN_VALUE) &&
-                !Objects.equals(assignmentState.clientId, 
ConsumerGroupCommand.MISSING_COLUMN_VALUE) &&
-                !Objects.equals(assignmentState.host, 
ConsumerGroupCommand.MISSING_COLUMN_VALUE);
-        }, "Expected a 'Stable' group status, rows and valid member 
information for group " + GROUP + ".");
+                    Optional<PartitionAssignmentState> maybePartitionState = 
assignments.get().stream().filter(isGrp).findFirst();
+                    if (!maybePartitionState.isPresent())
+                        return false;
 
-        Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, true);
+                    PartitionAssignmentState partitionState = 
maybePartitionState.get();
 
-        if (res.getValue().isPresent()) {
-            assertTrue(res.getValue().get().size() == 1 && 
res.getValue().get().iterator().next().assignment.size() == 1,
-                "Expected a topic partition assigned to the single group 
member for group " + GROUP);
-        } else {
-            fail("Expected partition assignments for members of group " + 
GROUP);
+                    return !partitionState.consumerId.map(s0 -> 
s0.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) &&
+                            !partitionState.clientId.map(s0 -> 
s0.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) &&
+                            !partitionState.host.map(h -> 
h.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false);
+                }, "Expected a 'Stable' group status, rows and valid values 
for consumer id / client id / host columns in describe results for group " + 
group + ".");
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeStateOfExistingGroup(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(
-            1,
-            groupProtocol,
-            // This is only effective when new protocol is used.
-            Optional.of("range")
-        );
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            GroupState state = service.collectGroupState(GROUP);
-            return Objects.equals(state.state, ConsumerGroupState.STABLE) &&
-                state.numMembers == 1 &&
-                Objects.equals(state.assignmentStrategy, "range") &&
-                state.coordinator != null &&
-                brokers().count(s -> s.config().brokerId() == 
state.coordinator.id()) > 0;
-        }, "Expected a 'Stable' group status, with one member and round robin 
assignment strategy for group " + GROUP + ".");
-    }
-
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeStateOfExistingGroupWithNonDefaultAssignor(String 
quorum, String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        String expectedName;
-        if (groupProtocol.equals("consumer")) {
-            addConsumerGroupExecutor(1, groupProtocol, Optional.of("range"));
-            expectedName = "range";
-        } else {
-            addConsumerGroupExecutor(1, TOPIC, GROUP, 
RoundRobinAssignor.class.getName(), Optional.empty(), Optional.empty(), false, 
groupProtocol);
-            expectedName = "roundrobin";
-        }
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            GroupState state = service.collectGroupState(GROUP);
-            return Objects.equals(state.state, ConsumerGroupState.STABLE) &&
-                state.numMembers == 1 &&
-                Objects.equals(state.assignmentStrategy, expectedName) &&
-                state.coordinator != null &&
-                brokers().count(s -> s.config().brokerId() == 
state.coordinator.id()) > 0;
-        }, "Expected a 'Stable' group status, with one member and " + 
expectedName + " assignment strategy for group " + GROUP + ".");
-    }
-
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeExistingGroupWithNoMembers(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
+    @ClusterTemplate("generator")
+    public void testDescribeMembersOfExistingGroup() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            String group = GROUP + String.join("", describeType);
             // run one consumer in the group consuming from a single-partition 
topic
-            ConsumerGroupExecutor executor = addConsumerGroupExecutor(1, 
TOPIC, group, groupProtocol);
-            List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group));
-            cgcArgs.addAll(describeType);
-            ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs.toArray(new String[0]));
-
-            TestUtils.waitForCondition(() -> {
-                Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
-                return res.getKey().trim().split("\n").length == 2 && 
res.getValue().isEmpty();
-            }, "Expected describe group results with one data row for describe 
type '" + String.join(" ", describeType) + "'");
-
-            // stop the consumer so the group has no active member anymore
-            executor.shutdown();
-            TestUtils.waitForCondition(
-                () -> 
ToolsTestUtils.grabConsoleError(describeGroups(service)).contains("Consumer 
group '" + group + "' has no active members."),
-                "Expected no active member in describe group results with 
describe type " + String.join(" ", describeType));
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> groupMembers = 
service.collectGroupMembers(group, false);
+                    Optional<ConsumerGroupState> state = groupMembers.getKey();
+                    Optional<Collection<MemberAssignmentState>> assignments = 
groupMembers.getValue();
+
+                    Predicate<MemberAssignmentState> isGrp = s -> 
Objects.equals(s.group, group);
+
+                    boolean res = state.map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
+                            assignments.isPresent() &&
+                            assignments.get().stream().filter(s -> 
Objects.equals(s.group, group)).count() == 1;
+
+                    if (!res)
+                        return false;
+
+                    Optional<MemberAssignmentState> maybeAssignmentState = 
assignments.get().stream().filter(isGrp).findFirst();
+                    if (!maybeAssignmentState.isPresent())
+                        return false;
+
+                    MemberAssignmentState assignmentState = 
maybeAssignmentState.get();
+
+                    return !Objects.equals(assignmentState.consumerId, 
ConsumerGroupCommand.MISSING_COLUMN_VALUE) &&
+                            !Objects.equals(assignmentState.clientId, 
ConsumerGroupCommand.MISSING_COLUMN_VALUE) &&
+                            !Objects.equals(assignmentState.host, 
ConsumerGroupCommand.MISSING_COLUMN_VALUE);
+                }, "Expected a 'Stable' group status, rows and valid member 
information for group " + group + ".");
+
+                Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, true);
+
+                if (res.getValue().isPresent()) {
+                    assertTrue(res.getValue().get().size() == 1 && 
res.getValue().get().iterator().next().assignment.size() == 1,
+                            "Expected a topic partition assigned to the single 
group member for group " + group);
+                } else {
+                    fail("Expected partition assignments for members of group 
" + group);
+                }
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeOffsetsOfExistingGroupWithNoMembers(String quorum, 
String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        ConsumerGroupExecutor executor = addConsumerGroupExecutor(1, TOPIC, 
GROUP, RangeAssignor.class.getName(), Optional.empty(), Optional.empty(), true, 
groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(GROUP);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false)
-                && res.getValue().map(c -> c.stream().anyMatch(assignment -> 
Objects.equals(assignment.group, GROUP) && 
assignment.offset.isPresent())).orElse(false);
-        }, "Expected the group to initially become stable, and to find group 
in assignments after initial offset commit.");
+    @ClusterTemplate("generator")
+    public void testDescribeStateOfExistingGroup() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        // stop the consumer so the group has no active member anymore
-        executor.shutdown();
-
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> offsets = 
service.collectGroupOffsets(GROUP);
-            Optional<ConsumerGroupState> state = offsets.getKey();
-            Optional<Collection<PartitionAssignmentState>> assignments = 
offsets.getValue();
-            List<PartitionAssignmentState> testGroupAssignments = 
assignments.get().stream().filter(a -> Objects.equals(a.group, 
GROUP)).collect(Collectors.toList());
-            PartitionAssignmentState assignment = testGroupAssignments.get(0);
-            return state.map(s -> 
s.equals(ConsumerGroupState.EMPTY)).orElse(false) &&
-                testGroupAssignments.size() == 1 &&
-                assignment.consumerId.map(c -> 
c.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) && // 
the member should be gone
-                assignment.clientId.map(c -> 
c.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) &&
-                assignment.host.map(c -> 
c.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false);
-        }, "failed to collect group offsets");
+            // run one consumer in the group consuming from a single-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, 
Collections.singletonMap(ConsumerConfig.GROUP_REMOTE_ASSIGNOR_CONFIG, "range"));
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    GroupState state = service.collectGroupState(group);
+                    return Objects.equals(state.state, 
ConsumerGroupState.STABLE) &&
+                            state.numMembers == 1 &&
+                            state.coordinator != null &&
+                            
clusterInstance.brokerIds().contains(state.coordinator.id());
+                }, "Expected a 'Stable' group status, with one member for 
group " + group + ".");
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeMembersOfExistingGroupWithNoMembers(String quorum, 
String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run one consumer in the group consuming from a single-partition 
topic
-        ConsumerGroupExecutor executor = addConsumerGroupExecutor(1, 
groupProtocol);
+    @ClusterTemplate("generator")
+    public void testDescribeStateOfExistingGroupWithNonDefaultAssignor() 
throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
+            // run one consumer in the group consuming from a single-partition 
topic
+            AutoCloseable protocolConsumerGroupExecutor = null;
+            try {
+                String expectedName;
+                if (groupProtocol.equals(GroupProtocol.CONSUMER)) {
+                    protocolConsumerGroupExecutor = 
consumerGroupClosable(GroupProtocol.CONSUMER, group, topic, 
Collections.singletonMap(ConsumerConfig.GROUP_REMOTE_ASSIGNOR_CONFIG, "range"));
+                    expectedName = RangeAssignor.RANGE_ASSIGNOR_NAME;
+                } else {
+                    protocolConsumerGroupExecutor = 
consumerGroupClosable(GroupProtocol.CLASSIC, group, topic, 
Collections.singletonMap(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG, 
RoundRobinAssignor.class.getName()));
+                    expectedName = RoundRobinAssignor.ROUNDROBIN_ASSIGNOR_NAME;
+                }
+
+                try (ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});) {
+                    TestUtils.waitForCondition(() -> {
+                        GroupState state = service.collectGroupState(group);
+                        return Objects.equals(state.state, 
ConsumerGroupState.STABLE) &&
+                                state.numMembers == 1 &&
+                                Objects.equals(state.assignmentStrategy, 
expectedName) &&
+                                state.coordinator != null &&
+                                
clusterInstance.brokerIds().contains(state.coordinator.id());
+                    }, "Expected a 'Stable' group status, with one member and 
" + expectedName + " assignment strategy for group " + group + ".");
+                }
+            } finally {
+                if (protocolConsumerGroupExecutor != null) {
+                    protocolConsumerGroupExecutor.close();
+                }
+            }
+        }
+    }
 
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, false);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false)
-                && res.getValue().map(c -> c.stream().anyMatch(m -> 
Objects.equals(m.group, GROUP))).orElse(false);
-        }, "Expected the group to initially become stable, and to find group 
in assignments after initial offset commit.");
+    @ClusterTemplate("generator")
+    public void testDescribeExistingGroupWithNoMembers() throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            createTopic(topic);
+
+            for (List<String> describeType : DESCRIBE_TYPES) {
+                String group = GROUP_PREFIX + groupProtocol.name() + 
String.join("", describeType);
+                // run one consumer in the group consuming from a 
single-partition topic
+                try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                     ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+                ) {
+                    TestUtils.waitForCondition(() -> {
+                        Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
+                        return res.getKey().trim().split("\n").length == 2 && 
res.getValue().isEmpty();
+                    }, "Expected describe group results with one data row for 
describe type '" + String.join(" ", describeType) + "'");
+
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(group);
+                    protocolConsumerGroupExecutor.close();
+                    TestUtils.waitForCondition(
+                            () -> 
ToolsTestUtils.grabConsoleError(describeGroups(service)).contains("Consumer 
group '" + group + "' has no active members."),
+                            "Expected no active member in describe group 
results with describe type " + String.join(" ", describeType));
+                }
+            }
+        }
+    }
 
-        // stop the consumer so the group has no active member anymore
-        executor.shutdown();
+    @ClusterTemplate("generator")
+    public void testDescribeOffsetsOfExistingGroupWithNoMembers() throws 
Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, false);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.EMPTY)).orElse(false) && res.getValue().isPresent() 
&& res.getValue().get().isEmpty();
-        }, "Expected no member in describe group members results for group '" 
+ GROUP + "'");
+            // run one consumer in the group consuming from a single-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(group);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false)
+                            && res.getValue().map(c -> 
c.stream().anyMatch(assignment -> Objects.equals(assignment.group, group) && 
assignment.offset.isPresent())).orElse(false);
+                }, "Expected the group to initially become stable, and to find 
group in assignments after initial offset commit.");
+
+                // stop the consumer so the group has no active member anymore
+                protocolConsumerGroupExecutor.close();
+
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> offsets = 
service.collectGroupOffsets(group);
+                    Optional<ConsumerGroupState> state = offsets.getKey();
+                    Optional<Collection<PartitionAssignmentState>> assignments 
= offsets.getValue();
+                    List<PartitionAssignmentState> testGroupAssignments = 
assignments.get().stream().filter(a -> Objects.equals(a.group, 
group)).collect(Collectors.toList());
+                    PartitionAssignmentState assignment = 
testGroupAssignments.get(0);
+                    return state.map(s -> 
s.equals(ConsumerGroupState.EMPTY)).orElse(false) &&
+                            testGroupAssignments.size() == 1 &&
+                            assignment.consumerId.map(c -> 
c.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) && // 
the member should be gone
+                            assignment.clientId.map(c -> 
c.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false) &&
+                            assignment.host.map(c -> 
c.trim().equals(ConsumerGroupCommand.MISSING_COLUMN_VALUE)).orElse(false);
+                }, "failed to collect group offsets");
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeStateOfExistingGroupWithNoMembers(String quorum, 
String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
+    @ClusterTemplate("generator")
+    public void testDescribeMembersOfExistingGroupWithNoMembers() throws 
Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        // run one consumer in the group consuming from a single-partition 
topic
-        ConsumerGroupExecutor executor = addConsumerGroupExecutor(1, 
groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
+            // run one consumer in the group consuming from a single-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, false);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false)
+                            && res.getValue().map(c -> c.stream().anyMatch(m 
-> Objects.equals(m.group, group))).orElse(false);
+                }, "Expected the group to initially become stable, and to find 
group in assignments after initial offset commit.");
+
+                // stop the consumer so the group has no active member anymore
+                protocolConsumerGroupExecutor.close();
+
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, false);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.EMPTY)).orElse(false) && res.getValue().isPresent() 
&& res.getValue().get().isEmpty();
+                }, "Expected no member in describe group members results for 
group '" + group + "'");
+            }
+        }
+    }
 
-        TestUtils.waitForCondition(() -> {
-            GroupState state = service.collectGroupState(GROUP);
-            return Objects.equals(state.state, ConsumerGroupState.STABLE) &&
-                state.numMembers == 1 &&
-                state.coordinator != null &&
-                brokers().count(s -> s.config().brokerId() == 
state.coordinator.id()) > 0;
-        }, "Expected the group '" + GROUP + "' to initially become stable, and 
have a single member.");
+    @ClusterTemplate("generator")
+    public void testDescribeStateOfExistingGroupWithNoMembers() throws 
Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        // stop the consumer so the group has no active member anymore
-        executor.shutdown();
+            // run one consumer in the group consuming from a single-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap());
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    GroupState state = service.collectGroupState(group);
+                    return Objects.equals(state.state, 
ConsumerGroupState.STABLE) &&
+                            state.numMembers == 1 &&
+                            state.coordinator != null &&
+                            
clusterInstance.brokerIds().contains(state.coordinator.id());
+                }, "Expected the group to initially become stable, and have a 
single member.");
+
+                // stop the consumer so the group has no active member anymore
+                protocolConsumerGroupExecutor.close();
+
+                TestUtils.waitForCondition(() -> {
+                    GroupState state = service.collectGroupState(group);
+                    return Objects.equals(state.state, 
ConsumerGroupState.EMPTY) && state.numMembers == 0;
+                }, "Expected the group to become empty after the only member 
leaving.");
+            }
+        }
+    }
 
-        TestUtils.waitForCondition(() -> {
-            GroupState state = service.collectGroupState(GROUP);
-            return Objects.equals(state.state, ConsumerGroupState.EMPTY) && 
state.numMembers == 0;
-        }, "Expected the group '" + GROUP + "' to become empty after the only 
member leaving.");
+    @ClusterTemplate("generator")
+    public void testDescribeWithConsumersWithoutAssignedPartitions() throws 
Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            createTopic(topic);
+
+            for (List<String> describeType : DESCRIBE_TYPES) {
+                String group = GROUP_PREFIX + groupProtocol.name() + 
String.join("", describeType);
+                List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group));
+                cgcArgs.addAll(describeType);
+                // run two consumers in the group consuming from a 
single-partition topic
+                try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                     ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(cgcArgs.toArray(new String[0]));
+                ) {
+                    TestUtils.waitForCondition(() -> {
+                        Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
+                        int expectedNumRows = 
DESCRIBE_TYPE_MEMBERS.contains(describeType) ? 3 : 2;
+                        return res.getValue().isEmpty() && 
res.getKey().trim().split("\n").length == expectedNumRows;
+                    }, "Expected a single data row in describe group result 
with describe type '" + String.join(" ", describeType) + "'");
+                }
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeWithConsumersWithoutAssignedPartitions(String 
quorum, String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
+    @ClusterTemplate("generator")
+    public void testDescribeOffsetsWithConsumersWithoutAssignedPartitions() 
throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            String group = GROUP + String.join("", describeType);
             // run two consumers in the group consuming from a 
single-partition topic
-            addConsumerGroupExecutor(2, TOPIC, group, groupProtocol);
-            List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group));
-            cgcArgs.addAll(describeType);
-            ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs.toArray(new String[0]));
-
-            TestUtils.waitForCondition(() -> {
-                Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
-                int expectedNumRows = 
DESCRIBE_TYPE_MEMBERS.contains(describeType) ? 3 : 2;
-                return res.getValue().isEmpty() && 
res.getKey().trim().split("\n").length == expectedNumRows;
-            }, "Expected a single data row in describe group result with 
describe type '" + String.join(" ", describeType) + "'");
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(group);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).isPresent() &&
+                            res.getValue().isPresent() &&
+                            res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, group)).count() == 1 &&
+                            res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, group) && x.partition.isPresent()).count() == 1;
+                }, "Expected rows for consumers with no assigned partitions in 
describe group results");
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void 
testDescribeOffsetsWithConsumersWithoutAssignedPartitions(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
+    @ClusterTemplate("generator")
+    public void testDescribeMembersWithConsumersWithoutAssignedPartitions() 
throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        // run two consumers in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(2, groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(GROUP);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).isPresent() &&
-                res.getValue().isPresent() &&
-                res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, GROUP)).count() == 1 &&
-                res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, GROUP) && x.partition.isPresent()).count() == 1;
-        }, "Expected rows for consumers with no assigned partitions in 
describe group results");
+            // run two consumers in the group consuming from a 
single-partition topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, false);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
+                            res.getValue().isPresent() &&
+                            res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, group)).count() == 2 &&
+                            res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, group) && x.numPartitions == 1).count() == 1 &&
+                            res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, group) && x.numPartitions == 0).count() == 1 &&
+                            res.getValue().get().stream().allMatch(s -> 
s.assignment.isEmpty());
+                }, "Expected rows for consumers with no assigned partitions in 
describe group results");
+
+                Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, true);
+                assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false)
+                                && res.getValue().map(c -> 
c.stream().anyMatch(s -> !s.assignment.isEmpty())).orElse(false),
+                        "Expected additional columns in verbose version of 
describe members");
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void 
testDescribeMembersWithConsumersWithoutAssignedPartitions(String quorum, String 
groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run two consumers in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(2, groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, false);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
-                res.getValue().isPresent() &&
-                res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, GROUP)).count() == 2 &&
-                res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, GROUP) && x.numPartitions == 1).count() == 1 &&
-                res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, GROUP) && x.numPartitions == 0).count() == 1 &&
-                res.getValue().get().stream().allMatch(s -> 
s.assignment.isEmpty());
-        }, "Expected rows for consumers with no assigned partitions in 
describe group results");
+    @ClusterTemplate("generator")
+    public void testDescribeStateWithConsumersWithoutAssignedPartitions() 
throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic);
 
-        Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, true);
-        assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false)
-                && res.getValue().map(c -> c.stream().anyMatch(s -> 
!s.assignment.isEmpty())).orElse(false),
-            "Expected additional columns in verbose version of describe 
members");
+            // run two consumers in the group consuming from a 
single-partition topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    GroupState state = service.collectGroupState(group);
+                    return Objects.equals(state.state, 
ConsumerGroupState.STABLE) && state.numMembers == 2;
+                }, "Expected two consumers in describe group results");
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeStateWithConsumersWithoutAssignedPartitions(String 
quorum, String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-
-        // run two consumers in the group consuming from a single-partition 
topic
-        addConsumerGroupExecutor(2, groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            GroupState state = service.collectGroupState(GROUP);
-            return Objects.equals(state.state, ConsumerGroupState.STABLE) && 
state.numMembers == 2;
-        }, "Expected two consumers in describe group results");
+    @ClusterTemplate("generator")
+    public void testDescribeWithMultiPartitionTopicAndMultipleConsumers() 
throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            createTopic(topic, 2);
+
+            for (List<String> describeType : DESCRIBE_TYPES) {
+                String group = GROUP_PREFIX + groupProtocol.name() + 
String.join("", describeType);
+                List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group));
+                cgcArgs.addAll(describeType);
+                // run two consumers in the group consuming from a 
two-partition topic
+                try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                     ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(cgcArgs.toArray(new String[0]));
+                ) {
+                    TestUtils.waitForCondition(() -> {
+                        Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
+                        int expectedNumRows = 
DESCRIBE_TYPE_STATE.contains(describeType) ? 2 : 3;
+                        return res.getValue().isEmpty() && 
res.getKey().trim().split("\n").length == expectedNumRows;
+                    }, "Expected a single data row in describe group result 
with describe type '" + String.join(" ", describeType) + "'");
+                }
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void testDescribeWithMultiPartitionTopicAndMultipleConsumers(String 
quorum, String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-        String topic2 = "foo2";
-        createTopic(topic2, 2, 1, new Properties(), listenerName(), new 
Properties());
+    @ClusterTemplate("generator")
+    public void 
testDescribeOffsetsWithMultiPartitionTopicAndMultipleConsumers() throws 
Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic, 2);
 
-        for (List<String> describeType : DESCRIBE_TYPES) {
-            String group = GROUP + String.join("", describeType);
             // run two consumers in the group consuming from a two-partition 
topic
-            addConsumerGroupExecutor(2, topic2, group, groupProtocol);
-            List<String> cgcArgs = new 
ArrayList<>(Arrays.asList("--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", group));
-            cgcArgs.addAll(describeType);
-            ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs.toArray(new String[0]));
-
-            TestUtils.waitForCondition(() -> {
-                Entry<String, String> res = 
ToolsTestUtils.grabConsoleOutputAndError(describeGroups(service));
-                int expectedNumRows = 
DESCRIBE_TYPE_STATE.contains(describeType) ? 2 : 3;
-                return res.getValue().isEmpty() && 
res.getKey().trim().split("\n").length == expectedNumRows;
-            }, "Expected a single data row in describe group result with 
describe type '" + String.join(" ", describeType) + "'");
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(group);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
+                            res.getValue().isPresent() &&
+                            res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, group)).count() == 2 &&
+                            res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, group) && x.partition.isPresent()).count() == 2 &&
+                            res.getValue().get().stream().noneMatch(x -> 
Objects.equals(x.group, group) && !x.partition.isPresent());
+                }, "Expected two rows (one row per consumer) in describe group 
results.");
+            }
         }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void 
testDescribeOffsetsWithMultiPartitionTopicAndMultipleConsumers(String quorum, 
String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-        String topic2 = "foo2";
-        createTopic(topic2, 2, 1, new Properties(), listenerName(), new 
Properties());
-
-        // run two consumers in the group consuming from a two-partition topic
-        addConsumerGroupExecutor(2, topic2, GROUP, groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
+    @ClusterTemplate("generator")
+    public void 
testDescribeMembersWithMultiPartitionTopicAndMultipleConsumers() throws 
Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic, 2);
 
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<PartitionAssignmentState>>> res = 
service.collectGroupOffsets(GROUP);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
-                res.getValue().isPresent() &&
-                res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, GROUP)).count() == 2 &&
-                res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, GROUP) && x.partition.isPresent()).count() == 2 &&
-                res.getValue().get().stream().noneMatch(x -> 
Objects.equals(x.group, GROUP) && !x.partition.isPresent());
-        }, "Expected two rows (one row per consumer) in describe group 
results.");
+            // run two consumers in the group consuming from a two-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, false);
+                    return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
+                            res.getValue().isPresent() &&
+                            res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, group)).count() == 2 &&
+                            res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, group) && x.numPartitions == 1).count() == 2 &&
+                            res.getValue().get().stream().noneMatch(x -> 
Objects.equals(x.group, group) && x.numPartitions == 0);
+                }, "Expected two rows (one row per consumer) in describe group 
members results.");
+
+                Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(group, true);
+                assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) && res.getValue().map(s -> 
s.stream().filter(x -> x.assignment.isEmpty()).count()).orElse(0L) == 0,
+                        "Expected additional columns in verbose version of 
describe members");
+            }
+        }
     }
 
-    @ParameterizedTest(name = 
TEST_WITH_PARAMETERIZED_QUORUM_AND_GROUP_PROTOCOL_NAMES)
-    @MethodSource({"getTestQuorumAndGroupProtocolParametersAll"})
-    public void 
testDescribeMembersWithMultiPartitionTopicAndMultipleConsumers(String quorum, 
String groupProtocol) throws Exception {
-        createOffsetsTopic(listenerName(), new Properties());
-        String topic2 = "foo2";
-        createTopic(topic2, 2, 1, new Properties(), listenerName(), new 
Properties());
+    @ClusterTemplate("generator")
+    public void testDescribeStateWithMultiPartitionTopicAndMultipleConsumers() 
throws Exception {
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic, 2);
 
-        // run two consumers in the group consuming from a two-partition topic
-        addConsumerGroupExecutor(2, topic2, GROUP, groupProtocol);
-
-        String[] cgcArgs = new String[]{"--bootstrap-server", 
bootstrapServers(listenerName()), "--describe", "--group", GROUP};
-        ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(cgcArgs);
-
-        TestUtils.waitForCondition(() -> {
-            Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, false);
-            return res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) &&
-                res.getValue().isPresent() &&
-                res.getValue().get().stream().filter(s -> 
Objects.equals(s.group, GROUP)).count() == 2 &&
-                res.getValue().get().stream().filter(x -> 
Objects.equals(x.group, GROUP) && x.numPartitions == 1).count() == 2 &&
-                res.getValue().get().stream().noneMatch(x -> 
Objects.equals(x.group, GROUP) && x.numPartitions == 0);
-        }, "Expected two rows (one row per consumer) in describe group members 
results.");
+            // run two consumers in the group consuming from a two-partition 
topic
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, group, topic, Collections.emptyMap(), 2);
+                 ConsumerGroupCommand.ConsumerGroupService service = 
consumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--describe", "--group", group});
+            ) {
+                TestUtils.waitForCondition(() -> {
+                    GroupState state = service.collectGroupState(group);
+                    return Objects.equals(state.state, 
ConsumerGroupState.STABLE) && Objects.equals(state.group, group) && 
state.numMembers == 2;
+                }, "Expected a stable group with two members in describe group 
state result.");
+            }
+        }
+    }
 
-        Entry<Optional<ConsumerGroupState>, 
Optional<Collection<MemberAssignmentState>>> res = 
service.collectGroupMembers(GROUP, true);
-        assertTrue(res.getKey().map(s -> 
s.equals(ConsumerGroupState.STABLE)).orElse(false) && res.getValue().map(s -> 
s.stream().filter(x -> x.assignment.isEmpty()).count()).orElse(0L) == 0,
-            "Expected additional columns in verbose version of describe 
members");
+    @ClusterTemplate("generator")
+    public void testDescribeSimpleConsumerGroup() throws Exception {
+        // Ensure that the offsets of consumers which don't use group 
management are still displayed
+        for (GroupProtocol groupProtocol: 
clusterInstance.supportedGroupProtocols()) {
+            String topic = TOPIC_PREFIX + groupProtocol.name();
+            String group = GROUP_PREFIX + groupProtocol.name();
+            createTopic(topic, 2);
+
+            try (AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(GroupProtocol.CLASSIC, group, new 
HashSet<>(Arrays.asList(new TopicPartition(topic, 0), new TopicPartition(topic, 
1))), Collections.emptyMap());

Review Comment:
   This follows original test case. 
   
   1. It uses `addSimpleGroupExecutor`.
   
https://github.com/apache/kafka/blob/eea9ebf8a31126f797a4a325995e5e04d4993b74/tools/src/test/java/org/apache/kafka/tools/consumer/group/DescribeConsumerGroupTest.java#L710
   
   2. For `SimpleGroupExecutor`, it uses default group protocol, so I use 
CLASSIC here.
   
   
https://github.com/apache/kafka/blob/eea9ebf8a31126f797a4a325995e5e04d4993b74/tools/src/test/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommandTest.java#L164-L168
   
https://github.com/apache/kafka/blob/eea9ebf8a31126f797a4a325995e5e04d4993b74/tools/src/test/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommandTest.java#L317-L325
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to