Scanteianu commented on code in PR #12753: URL: https://github.com/apache/kafka/pull/12753#discussion_r1019998897
########## core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala: ########## @@ -694,6 +694,76 @@ class PlaintextConsumerTest extends BaseConsumerTest { assertEquals(outOfRangePos.toLong, outOfRangePartitions.get(tp)) } + @Test + def testFetchInvalidOffsetResetConfigEarliest(): Unit = { + this.consumerConfig.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + val consumer = createConsumer(configOverrides = this.consumerConfig) + val totalRecords = 10L + + val producer = createProducer() + val startingTimestamp = 0 + sendRecords(producer, totalRecords.toInt, tp, startingTimestamp = startingTimestamp) + consumer.assign(List(tp).asJava) + consumeAndVerifyRecords(consumer = consumer, numRecords = totalRecords.toInt, startingOffset =0) + // seek to out of range position + val outOfRangePos = totalRecords + 1 + consumer.seek(tp, outOfRangePos) + // assert that poll resets to the beginning position + consumeAndVerifyRecords(consumer = consumer, numRecords = 1, startingOffset = 0) + } + + @Test + def testFetchInvalidOffsetResetConfigLatest(): Unit = { + + this.consumerConfig.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest") + val consumer = createConsumer(configOverrides = this.consumerConfig) Review Comment: this is an AMAZING explanation, and I really appreciate you taking the time to help me understand what's going on. My hope with the proposal in KIP-886 is that this should be easier for someone to discover as they are building a producer or consumer, especially if the documentation is good for setting configs like `AUTO_OFFSET_RESET_CONFIG` (ie: it can mention that "latest" interacts with the `FETCH_MAX_MS_WAIT_CONFIG`) -- 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