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

chia7712 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 ab42f00bbe1 KAFKA-18486 Remove ReplicaManager#becomeLeaderOrFollower 
in `testVerificationErrorConversions` (#19923)
ab42f00bbe1 is described below

commit ab42f00bbe1f60fa34cabc101a5a102175607c32
Author: Nick Guo <[email protected]>
AuthorDate: Wed Jun 11 18:47:23 2025 +0800

    KAFKA-18486 Remove ReplicaManager#becomeLeaderOrFollower in 
`testVerificationErrorConversions` (#19923)
    
    Remove ReplicaManager#becomeLeaderOrFollower in
    `testVerificationErrorConversionsTV1 ` and
    `testVerificationErrorConversionsTV2 `.
    
    Reviewers: Ken Huang <[email protected]>, TengYao Chi
    <[email protected]>, Chia-Ping Tsai <[email protected]>
---
 .../test/scala/unit/kafka/server/ReplicaManagerTest.scala    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala 
b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
index f90b7fa9e55..04a1677b474 100644
--- a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
@@ -2649,6 +2649,7 @@ class ReplicaManagerTest {
     )
   )
   def testVerificationErrorConversionsTV2(error: Errors): Unit = {
+    val localId = 1
     val tp0 = new TopicPartition(topic, 0)
     val producerId = 24L
     val producerEpoch = 0.toShort
@@ -2657,9 +2658,8 @@ class ReplicaManagerTest {
 
     val replicaManager = 
setUpReplicaManagerWithMockedAddPartitionsToTxnManager(addPartitionsToTxnManager,
 List(tp0))
     try {
-      replicaManager.becomeLeaderOrFollower(1,
-        makeLeaderAndIsrRequest(topicIds(tp0.topic), tp0, Seq(0, 1), new 
LeaderAndIsr(1, List(0, 1).map(Int.box).asJava)),
-        (_, _) => ())
+      val leaderDelta = topicsCreateDelta(localId, isStartIdLeader = true, 
partitions = List(0, 1), List.empty, topic, topicIds(topic))
+      replicaManager.applyDelta(leaderDelta, 
imageFromTopics(leaderDelta.apply()))
 
       val transactionalRecords = 
MemoryRecords.withTransactionalRecords(Compression.NONE, producerId, 
producerEpoch, sequence,
         new SimpleRecord("message".getBytes))
@@ -2699,6 +2699,7 @@ class ReplicaManagerTest {
     )
   )
   def testVerificationErrorConversionsTV1(error: Errors): Unit = {
+    val localId = 1
     val tp0 = new TopicPartition(topic, 0)
     val producerId = 24L
     val producerEpoch = 0.toShort
@@ -2707,9 +2708,8 @@ class ReplicaManagerTest {
 
     val replicaManager = 
setUpReplicaManagerWithMockedAddPartitionsToTxnManager(addPartitionsToTxnManager,
 List(tp0))
     try {
-      replicaManager.becomeLeaderOrFollower(1,
-        makeLeaderAndIsrRequest(topicIds(tp0.topic), tp0, Seq(0, 1), new 
LeaderAndIsr(1, List(0, 1).map(Int.box).asJava)),
-        (_, _) => ())
+      val leaderDelta = topicsCreateDelta(localId, isStartIdLeader = true, 
partitions = List(0, 1), List.empty, topic, topicIds(topic))
+      replicaManager.applyDelta(leaderDelta, 
imageFromTopics(leaderDelta.apply()))
 
       val transactionalRecords = 
MemoryRecords.withTransactionalRecords(Compression.NONE, producerId, 
producerEpoch, sequence,
         new SimpleRecord("message".getBytes))

Reply via email to