jolshan commented on a change in pull request #11331:
URL: https://github.com/apache/kafka/pull/11331#discussion_r746100239
##########
File path: core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
##########
@@ -794,25 +793,26 @@ class ReplicaManagerTest {
// We receive one valid request from the follower and replica state is
updated
var successfulFetch: Option[FetchPartitionData] = None
- def callback(response: Seq[(TopicPartition, FetchPartitionData)]): Unit
= {
- successfulFetch = response.headOption.filter { case (topicPartition,
_) => topicPartition == tp }.map { case (_, data) => data }
- }
- val validFetchPartitionData = new FetchRequest.PartitionData(0L, 0L,
maxFetchBytes,
+ val validFetchPartitionData = new
FetchRequest.PartitionData(Uuid.ZERO_UUID, 0L, 0L, maxFetchBytes,
Optional.of(leaderEpoch))
// Fetch messages simulating a different ID than the one in the log.
+ val inconsistentTidp = new TopicIdPartition(Uuid.randomUuid(),
tidp.topicPartition)
+ def callback1(response: Seq[(TopicIdPartition, FetchPartitionData)]):
Unit = {
+ // Check the topic partition only since we are reusing this callback
on different TopicIdPartitions.
+ successfulFetch = response.headOption.filter(_._1 ==
inconsistentTidp).map(_._2)
+ }
Review comment:
Hmm. Could I also just remove the filter and do that after to use just
the single callback?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]