-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINOR: migrate DescribeConsumerGroupTest to use ClusterTestExtensions #15908
base: trunk
Are you sure you want to change the base?
MINOR: migrate DescribeConsumerGroupTest to use ClusterTestExtensions #15908
Conversation
@@ -92,6 +94,7 @@ static void generator(ClusterGenerator clusterGenerator) { | |||
static <T> AutoCloseable buildConsumers(int numberOfConsumers, | |||
boolean syncCommit, | |||
String topic, | |||
Collection<TopicPartition> topicPartitions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Change to set
to be more specific.
@@ -311,6 +311,7 @@ private AutoCloseable consumerGroupClosable(ClusterInstance cluster, GroupProtoc | |||
1, | |||
false, | |||
topicName, | |||
null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could we use empty set instead of null here?
GroupProtocol groupProtocol = clusterInstance.config().serverProperties().get(GroupCoordinatorConfig.NEW_GROUP_COORDINATOR_ENABLE_CONFIG).trim().equals("true") ? GroupProtocol.CONSUMER : GroupProtocol.CLASSIC; | ||
try (AutoCloseable protocolConsumerGroupExecutor = consumerGroupClosable(groupProtocol, PROTOCOL_GROUP, TOPIC, Collections.emptyMap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me that we could put the logic of determining groupProtocol
in consumerGroupClosable
method, so that we don't have to do the same thing in each test. Ex: Add a consumerGroupClosable
method, and replace the groupProtocol
with clusterInstance.config().serverProperties()
. So we can do the groupProtocol determination inside the consumerGroupClosable
method:
private AutoCloseable consumerGroupClosable(Map<String, String> serverProperties, GroupProtocol protocol, String groupId, String topicName) {
GroupProtocol groupProtocol = serverProperties.get(GroupCoordinatorConfig.NEW_GROUP_COORDINATOR_ENABLE_CONFIG).trim().equals("true") ? GroupProtocol.CONSUMER : GroupProtocol.CLASSIC;
return consumerGroupClosable(groupProtocol, ...);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I found that I only run consumer group protocol when group.coordinator.new.enable
is true. I change to use ClusterInstance#supportedGroupProtocols
to check supported protocols, so we can run all cases like before. Thanks.
One high-level question:
Anyway, to me, one test class takes more than 1 hour is really unacceptable. Trunk: |
Forgot to say, thanks for closing all the |
79dfa65
to
0a6e0ce
Compare
Hi @showuon, thanks for the review and suggestion. Originally, old framework run 4 cases:
In the new framework, we run 7 cases:
That is why testing time takes longer. In my latest update, I change to run following cases. Also, in old framework, we started KRAFT server with group.coordinator.new.enable=true twice. One for classic group protocol and another for consumer group protocol. In new framework, we can get supported group protocol by
|
fc7ebc5
to
3cbd36d
Compare
|
||
import java.util.stream.Stream; | ||
|
||
//import static kafka.test.annotation.Type.CO_KRAFT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this mark be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it. Thanks.
3cbd36d
to
bcffd08
Compare
agree. could this PR include this change? |
Yes, I already changed it. Please take a look for |
Signed-off-by: PoAn Yang <payang@apache.org>
bcffd08
to
1faf820
Compare
@FrankYang0529 please fix the conflicts, thanks! |
By using ClusterTestExtensions, DescribeConsumerGroupTest get get away from KafkaServerTestHarness dependency.
Committer Checklist (excluded from commit message)