Yunyung commented on code in PR #20014:
URL: https://github.com/apache/kafka/pull/20014#discussion_r2161703461


##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -1893,13 +1859,11 @@ class ReplicaManagerTest {
 
     val replicaManager = 
setUpReplicaManagerWithMockedAddPartitionsToTxnManager(addPartitionsToTxnManager,
 List(tp0, tp1))
     try {
-      replicaManager.becomeLeaderOrFollower(1,
-        makeLeaderAndIsrRequest(topicIds(tp0.topic), tp0, Seq(0, 1), new 
LeaderAndIsr(1, List(0, 1).map(Int.box).asJava)),
-        (_, _) => ())
-
-      replicaManager.becomeLeaderOrFollower(1,
-        makeLeaderAndIsrRequest(topicIds(tp1.topic), tp1, Seq(0, 1), new 
LeaderAndIsr(1, List(0, 1).map(Int.box).asJava)),
-        (_, _) => ())
+      // Step 1: Apply KRaft metadata to assign tp0 and tp1 as leaders
+      val directoryIds = replicaManager.logManager.directoryIdsSet.toList
+      val leaderDelta = topicsCreateDelta(startId = 0, isStartIdLeader = true, 
partitions = List(0, 1), directoryIds = directoryIds, topic, topicIds(topic))

Review Comment:
   Fix the test:
   ```suggestion
         val leaderDelta = topicsCreateDelta(startId = 0, isStartIdLeader = 
false, partitions = List(0, 1), List.empty, topic, topicIds(topic))
   ```
   



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