FrankYang0529 commented on code in PR #18632: URL: https://github.com/apache/kafka/pull/18632#discussion_r1926309864
########## core/src/test/scala/unit/kafka/cluster/PartitionLockTest.scala: ########## @@ -348,6 +348,7 @@ class PartitionLockTest extends Logging { val controllerEpoch = 0 val replicas = (0 to numReplicaFetchers).map(i => Integer.valueOf(brokerId + i)).toList.asJava val isr = replicas + replicas.forEach(replicaId => when(metadataCache.getAliveBrokerEpoch(replicaId)).thenReturn(Some(1L))) Review Comment: We use `mock(classOf[MetadataCache])` for `metadataCache`, so it didn't really get into `KRaftMetadataCache` block. In this PR, we remove `match` block, so we have to add related mock. https://github.com/apache/kafka/blob/94a1bfb1281f06263976b1ba8bba8c5ac5d7f2ce/core/src/test/scala/unit/kafka/cluster/PartitionLockTest.scala#L270 https://github.com/apache/kafka/blob/94a1bfb1281f06263976b1ba8bba8c5ac5d7f2ce/core/src/main/scala/kafka/cluster/Replica.scala#L116-L125 ########## core/src/test/scala/unit/kafka/cluster/PartitionTest.scala: ########## @@ -186,6 +186,7 @@ class PartitionTest extends AbstractPartitionTest { val leaderEpoch = 10 val logStartOffset = 0L val partition = setupPartitionWithMocks(leaderEpoch = leaderEpoch, isLeader = true) + addBrokerEpochToMockMetadataCache(metadataCache, List(remoteReplicaId)) Review Comment: Same as above. We use `mock(classOf[MetadataCache])` in `AbstractPartitionTest`. https://github.com/apache/kafka/blob/94a1bfb1281f06263976b1ba8bba8c5ac5d7f2ce/core/src/test/scala/unit/kafka/cluster/AbstractPartitionTest.scala#L64 -- 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