showuon commented on a change in pull request #9178: URL: https://github.com/apache/kafka/pull/9178#discussion_r486751134
########## File path: core/src/test/scala/unit/kafka/log/LogCleanerManagerTest.scala ########## @@ -361,6 +366,93 @@ class LogCleanerManagerTest extends Logging { assertEquals("should have 1 logs ready to be deleted", 1, deletableLog3.size) } + @Test + def testUpdateCheckpointsShouldAddOffsetToPartition(): Unit = { + val records = TestUtils.singletonRecords("test".getBytes, key="test".getBytes) + val log: Log = createLog(records.sizeInBytes * 5, LogConfig.Compact) + val cleanerManager: LogCleanerManager = createCleanerManager(log) + + // expect the checkpoint offset is not the expectedOffset before doing updateCheckpoints + assertNotEquals(offset, cleanerManager.allCleanerCheckpoints.get(topicPartition).getOrElse(0)) + + cleanerManager.updateCheckpoints(logDir, Option(topicPartition, offset)) + // expect the checkpoint offset is now updated to the expectedOffset after doing updateCheckpoints + assertEquals(offset, cleanerManager.allCleanerCheckpoints.get(topicPartition).get) Review comment: Nice refactor! Thanks. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org