cadonna commented on code in PR #15372: URL: https://github.com/apache/kafka/pull/15372#discussion_r1494650399
########## core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala: ########## @@ -265,6 +265,32 @@ class PlaintextConsumerTest extends BaseConsumerTest { ensureNoRebalance(consumer, listener) } + @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) + @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) + def testMaxPollIntervalMsShorterThanPollTimeout(quorum: String, groupProtocol: String): Unit = { + this.consumerConfig.setProperty(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, 1000.toString) + this.consumerConfig.setProperty(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, 500.toString) + + val consumer = createConsumer() + val listener = new TestConsumerReassignmentListener + consumer.subscribe(List(topic).asJava, listener) + + // rebalance to get the initial assignment + awaitRebalance(consumer, listener) + + val initialAssignedCalls = listener.callsToAssigned + + consumer.poll(Duration.ofMillis(2000)) + + // Give enough time to rejoin + consumer.poll(Duration.ofMillis(500)) + consumer.poll(Duration.ofMillis(500)) + + // Check that we did not rejoin Review Comment: Do we need this comment? I think it would be better to delete it and to rename `initialAssignedCalls` to something more meaningful like `callsToAssignedAfterFirstRebalance` or `callsToAssignedBeforePolls`. ########## core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala: ########## @@ -265,6 +265,32 @@ class PlaintextConsumerTest extends BaseConsumerTest { ensureNoRebalance(consumer, listener) } + @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) + @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) + def testMaxPollIntervalMsShorterThanPollTimeout(quorum: String, groupProtocol: String): Unit = { + this.consumerConfig.setProperty(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, 1000.toString) + this.consumerConfig.setProperty(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, 500.toString) + + val consumer = createConsumer() + val listener = new TestConsumerReassignmentListener + consumer.subscribe(List(topic).asJava, listener) + + // rebalance to get the initial assignment + awaitRebalance(consumer, listener) + + val initialAssignedCalls = listener.callsToAssigned + + consumer.poll(Duration.ofMillis(2000)) + + // Give enough time to rejoin Review Comment: nit: This comment is a bit confusing. What is it supposed to clarify? -- 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