m1a2st commented on code in PR #19924:
URL: https://github.com/apache/kafka/pull/19924#discussion_r2135620371


##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -451,20 +451,21 @@ class ReplicaManagerTest {
       partition.createLogIfNotExists(isNew = false, isFutureReplica = false,
         new LazyOffsetCheckpoints(rm.highWatermarkCheckpoints.asJava), None)
       // Make this replica the leader.
-      val leaderAndIsrRequest1 = new LeaderAndIsrRequest.Builder(0, 0, 
brokerEpoch,
-        Seq(new LeaderAndIsrRequest.PartitionState()
-          .setTopicName(topic)
-          .setPartitionIndex(0)
-          .setControllerEpoch(0)
-          .setLeader(0)
-          .setLeaderEpoch(0)
-          .setIsr(brokerList)
-          .setPartitionEpoch(0)
-          .setReplicas(brokerList)
-          .setIsNew(false)).asJava,
-        topicIds,
-        Set(new Node(0, "host1", 0), new Node(1, "host2", 1)).asJava).build()
-      rm.becomeLeaderOrFollower(0, leaderAndIsrRequest1, (_, _) => ())
+      val delta = new TopicsDelta(TopicsImage.EMPTY)
+      delta.replay(new 
TopicRecord().setName(topic).setTopicId(topicIds.get(topic)))
+      val record = new PartitionRecord()
+        .setPartitionId(0)
+        .setTopicId(topicIds.get(topic))
+        .setReplicas(brokerList)
+        .setIsr(brokerList)
+        .setRemovingReplicas(util.List.of())
+        .setAddingReplicas(util.List.of())
+        .setLeader(brokerList.get(0))
+        .setLeaderEpoch(0)
+        .setPartitionEpoch(0)
+      delta.replay(record)
+      val leaderMetadataImage = imageFromTopics(delta.apply())

Review Comment:
   I think it's okay not to inline this variable.



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