gaurav-narula commented on code in PR #20167:
URL: https://github.com/apache/kafka/pull/20167#discussion_r2205938396


##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -3603,6 +3603,7 @@ class ReplicaManagerTest {
     val tidp1 = new TopicIdPartition(topicId, tp1)
 
     val replicaManager = setupReplicaManagerWithMockedPurgatories(new 
MockTimer(time), aliveBrokerIds = Seq(0, 1, 2), enableRemoteStorage = true, 
shouldMockLog = true, remoteFetchQuotaExceeded = Some(false))
+    when(replicaManager.logManager.getOrCreateLog(tp0, isNew = false, isFuture 
= false, Optional.empty(), None).topicId()).thenReturn(Optional.of(topicId))

Review Comment:
   Thanks for the suggestion Chia! I've modified `TestUtils#createLogManager` 
to accept an `Option[(TopicPartition, Option[Uuid]] => UnifiedLog` instead of 
`Option[UnifiedLog]` and modified `ReplicaManagerTest#setupMockLog` to mock 
values appropriately.
   
   This way, `UnifiedLog#topicId` can be mocked while setting up the test and 
invoking `replicaManager.createPartition(tp).createLogIfNotExist()`



-- 
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

Reply via email to