mirror of https://github.com/apache/kafka.git
KAFKA-18486 Remove ReplicaManager#becomeLeaderOrFollower from `testReplicaAlterLogDirs` (#19922)
Use `applyDelta` replace `becomeLeaderOrFollower` Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
8fd0d33670
commit
e23c8cea07
|
@ -5864,6 +5864,7 @@ class ReplicaManagerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
def testReplicaAlterLogDirs(): Unit = {
|
def testReplicaAlterLogDirs(): Unit = {
|
||||||
|
val localId = 0
|
||||||
val tp = new TopicPartition(topic, 0)
|
val tp = new TopicPartition(topic, 0)
|
||||||
|
|
||||||
val mockReplicaAlterLogDirsManager = mock(classOf[ReplicaAlterLogDirsManager])
|
val mockReplicaAlterLogDirsManager = mock(classOf[ReplicaAlterLogDirsManager])
|
||||||
|
@ -5880,13 +5881,9 @@ class ReplicaManagerTest {
|
||||||
topicId = None
|
topicId = None
|
||||||
)
|
)
|
||||||
|
|
||||||
val leaderAndIsrRequest = makeLeaderAndIsrRequest(
|
val leaderDelta = topicsCreateDelta(localId, isStartIdLeader = true, partitions = List(0, 1), List.empty, topic, topicIds(topic))
|
||||||
topicId = topicId,
|
val leaderImage = imageFromTopics(leaderDelta.apply())
|
||||||
topicPartition = tp,
|
replicaManager.applyDelta(leaderDelta, leaderImage)
|
||||||
replicas = Seq(0, 1),
|
|
||||||
leaderAndIsr = new LeaderAndIsr(0, List(0, 1).map(Int.box).asJava),
|
|
||||||
)
|
|
||||||
replicaManager.becomeLeaderOrFollower(0, leaderAndIsrRequest, (_, _) => ())
|
|
||||||
|
|
||||||
// Move the replica to the second log directory.
|
// Move the replica to the second log directory.
|
||||||
val partition = replicaManager.getPartitionOrException(tp)
|
val partition = replicaManager.getPartitionOrException(tp)
|
||||||
|
|
Loading…
Reference in New Issue