CalvinConfluent commented on code in PR #13323: URL: https://github.com/apache/kafka/pull/13323#discussion_r1132971982
########## raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java: ########## @@ -1436,6 +1438,28 @@ public void testInvalidFetchRequest() throws Exception { context.assertSentFetchPartitionResponse(Errors.INVALID_REQUEST, epoch, OptionalInt.of(localId)); } + @Test + public void testFetchRequestVersionHandling() throws Exception { + int localId = 0; + int otherNodeId = 1; + int epoch = 5; + Set<Integer> voters = Utils.mkSet(localId, otherNodeId); + + RaftClientTestContext context = RaftClientTestContext.initializeAsLeader(localId, voters, epoch); + + // Latest fetch request. Review Comment: Refactored. ########## raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java: ########## @@ -1436,6 +1438,28 @@ public void testInvalidFetchRequest() throws Exception { context.assertSentFetchPartitionResponse(Errors.INVALID_REQUEST, epoch, OptionalInt.of(localId)); } + @Test + public void testFetchRequestVersionHandling() throws Exception { + int localId = 0; + int otherNodeId = 1; + int epoch = 5; + Set<Integer> voters = Utils.mkSet(localId, otherNodeId); + + RaftClientTestContext context = RaftClientTestContext.initializeAsLeader(localId, voters, epoch); + + // Latest fetch request. + FetchRequestData fetchRequestData = context.fetchRequest( + epoch, context.clusterId.toString(), otherNodeId, 0L, 0, 0); + context.deliverRequest(fetchRequestData); + context.pollUntilResponse(); + context.assertSentFetchPartitionResponse(Errors.NONE, epoch, OptionalInt.of(localId)); + + FetchRequest.maybeDownGradeReplicaState(fetchRequestData, (short) 14); Review Comment: Refactored. -- 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