Skip to content

Commit

Permalink
MINOR: reduce the test suits of consumer group tools (apache#16155)
Browse files Browse the repository at this point in the history
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
  • Loading branch information
m1a2st authored and wernerdv committed Jun 3, 2024
1 parent 94bb5ba commit 10eca36
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,37 @@

import static kafka.test.annotation.Type.CO_KRAFT;
import static kafka.test.annotation.Type.KRAFT;
import static kafka.test.annotation.Type.ZK;
import static org.apache.kafka.coordinator.group.GroupCoordinatorConfig.GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG;
import static org.apache.kafka.coordinator.group.GroupCoordinatorConfig.NEW_GROUP_COORDINATOR_ENABLE_CONFIG;
import static org.apache.kafka.coordinator.group.GroupCoordinatorConfig.OFFSETS_TOPIC_PARTITIONS_CONFIG;
import static org.apache.kafka.coordinator.group.GroupCoordinatorConfig.OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG;

/**
* The old test framework {@link kafka.api.BaseConsumerTest#getTestQuorumAndGroupProtocolParametersAll} test for the following cases:
* <ul>
* <li>(ZK / KRAFT servers) with (group.coordinator.new.enable=false) with (classic group protocol) = 2 cases</li>
* <li>(KRAFT server) with (group.coordinator.new.enable=true) with (classic group protocol) = 1 case</li>
* <li>(KRAFT server) with (group.coordinator.new.enable=true) with (consumer group protocol) = 1 case</li>
* </ul>
* <p>
* The new test framework run seven cases for the following cases:
* <ul>
* <li>(ZK / KRAFT / CO_KRAFT servers) with (group.coordinator.new.enable=false) with (classic group protocol) = 3 cases</li>
* <li>(KRAFT / CO_KRAFT servers) with (group.coordinator.new.enable=true) with (classic group protocol) = 2 cases</li>
* <li>(KRAFT / CO_KRAFT servers) with (group.coordinator.new.enable=true) with (consumer group protocol) = 2 cases</li>
* </ul>
* <p>
* We can reduce the number of cases as same as the old test framework by using the following methods:
* <ul>
* <li>{@link #forConsumerGroupCoordinator} for the case of (consumer group protocol)</li>
* <li>(CO_KRAFT servers) with (group.coordinator.new.enable=true) with (classic / consumer group protocols) = 2 cases</li>
* </ul>
* <ul>
* <li>{@link #forClassicGroupCoordinator} for the case of (classic group protocol)</li>
* <li>(ZK / KRAFT servers) with (group.coordinator.new.enable=false) with (classic group protocol) = 2 cases</li>
* </ul>
*/
class ConsumerGroupCommandTestUtils {

private ConsumerGroupCommandTestUtils() {
Expand All @@ -66,8 +92,8 @@ static List<ClusterConfig> forConsumerGroupCoordinator() {
serverProperties.put(GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, "classic,consumer");

return Collections.singletonList(ClusterConfig.defaultBuilder()
.setTypes(Stream.of(KRAFT, CO_KRAFT).collect(Collectors.toSet()))
.setFeatures(Collections.singletonMap(Features.GROUP_VERSION, GroupVersion.GV_1.featureLevel()))
.setTypes(Collections.singleton(CO_KRAFT))
.setServerProperties(serverProperties)
.setTags(Collections.singletonList("consumerGroupCoordinator"))
.build());
Expand All @@ -80,6 +106,7 @@ static List<ClusterConfig> forClassicGroupCoordinator() {
serverProperties.put(NEW_GROUP_COORDINATOR_ENABLE_CONFIG, "false");

return Collections.singletonList(ClusterConfig.defaultBuilder()
.setTypes(Stream.of(ZK, KRAFT).collect(Collectors.toSet()))
.setServerProperties(serverProperties)
.setTags(Collections.singletonList("classicGroupCoordinator"))
.build());
Expand Down

0 comments on commit 10eca36

Please sign in to comment.