You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jg...@apache.org on 2020/11/19 22:08:13 UTC

[kafka] branch trunk updated: MINOR: Enable testLogCleanerStats (#9608)

This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 31d84e6  MINOR: Enable testLogCleanerStats (#9608)
31d84e6 is described below

commit 31d84e66baf92544eda85e89552a4841026d07cd
Author: Matthew Wong <ma...@gmail.com>
AuthorDate: Thu Nov 19 14:06:46 2020 -0800

    MINOR: Enable testLogCleanerStats (#9608)
    
    The `testLogCleanerStats` test in `LogCleanerTest.scala` was not implemented but not enabled. This PR adds the `@Test` annotation, and also gives it a larger map to allow the test to pass as intended. Also fixes a few misleading comments.
    
    Reviewers: Jason Gustafson <ja...@confluent.io>
---
 core/src/test/scala/unit/kafka/log/LogCleanerTest.scala | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/core/src/test/scala/unit/kafka/log/LogCleanerTest.scala b/core/src/test/scala/unit/kafka/log/LogCleanerTest.scala
index 548b7b6..3b1584d 100755
--- a/core/src/test/scala/unit/kafka/log/LogCleanerTest.scala
+++ b/core/src/test/scala/unit/kafka/log/LogCleanerTest.scala
@@ -815,9 +815,10 @@ class LogCleanerTest {
                (0 until leo.toInt by 2).forall(!keys.contains(_)))
   }
 
+  @Test
   def testLogCleanerStats(): Unit = {
-    // because loadFactor is 0.75, this means we can fit 2 messages in the map
-    val cleaner = makeCleaner(2)
+    // because loadFactor is 0.75, this means we can fit 3 messages in the map
+    val cleaner = makeCleaner(4)
     val logProps = new Properties()
     logProps.put(LogConfig.SegmentBytesProp, 1024: java.lang.Integer)
 
@@ -901,7 +902,7 @@ class LogCleanerTest {
 
   @Test
   def testPartialSegmentClean(): Unit = {
-    // because loadFactor is 0.75, this means we can fit 2 messages in the map
+    // because loadFactor is 0.75, this means we can fit 1 message in the map
     val cleaner = makeCleaner(2)
     val logProps = new Properties()
     logProps.put(LogConfig.SegmentBytesProp, 1024: java.lang.Integer)
@@ -1449,9 +1450,9 @@ class LogCleanerTest {
   @Test
   def testBuildPartialOffsetMap(): Unit = {
     // because loadFactor is 0.75, this means we can fit 2 messages in the map
-    val map = new FakeOffsetMap(3)
     val log = makeLog()
-    val cleaner = makeCleaner(2)
+    val cleaner = makeCleaner(3)
+    val map = cleaner.offsetMap
 
     log.appendAsLeader(record(0,0), leaderEpoch = 0)
     log.appendAsLeader(record(1,1), leaderEpoch = 0)