adikou commented on code in PR #24199:
URL: https://github.com/apache/kafka/pull/24199#discussion_r4555285903
##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -3909,6 +3921,97 @@ public void
testEnforceRebalanceTriggersRebalanceOnNextPoll(GroupProtocol groupP
assertEquals(1, countingRebalanceListener.revokedCount);
}
+ // NOTE: this test uses the enforceRebalance API which is not implemented
in the CONSUMER group protocol.
+ @ParameterizedTest
+ @EnumSource(value = GroupProtocol.class, names = "CLASSIC")
+ public void
testSetRebalanceListenerNullSkipsCallbacksOnRebalance(GroupProtocol
groupProtocol) {
+ Time time = new MockTime(1L);
+ ConsumerMetadata metadata = createMetadata(subscription);
+ MockClient client = new MockClient(time, metadata);
+ consumer = newConsumer(groupProtocol, time, client, subscription,
metadata, assignor, false, groupInstanceId);
+ MockRebalanceListener countingRebalanceListener =
getCountingRebalanceListener();
+ initMetadata(client, Map.of(topic, 1, topic2, 1));
+
+ consumer.setRebalanceListener(countingRebalanceListener);
+ consumer.subscribe(Arrays.asList(topic, topic2));
+ Node node = metadata.fetch().nodes().get(0);
+ Node coordinator = prepareRebalance(client, node, assignor,
Arrays.asList(tp0, t2p0), null);
+
+ // two poll calls, since the first rebalance needs two round trips to
finish join / sync-group
+ consumer.poll(Duration.ZERO);
+ consumer.poll(Duration.ZERO);
+
+ assertEquals(Set.of(tp0, t2p0), consumer.assignment());
+ assertEquals(1, countingRebalanceListener.assignedCount);
+ assertEquals(0, countingRebalanceListener.revokedCount);
+
Review Comment:
Yes right, I was thinking of position.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]