dajac commented on a change in pull request #11331:
URL: https://github.com/apache/kafka/pull/11331#discussion_r745965419



##########
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:
       Hum.. I was thinking that the method would return the partitions and we 
would do the assertion after. That would make the helper generic enough to be 
reused in other places as well. I guess that either ways would work.




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