ahuang98 commented on code in PR #18240:
URL: https://github.com/apache/kafka/pull/18240#discussion_r1917424027


##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientPreVoteTest.java:
##########
@@ -430,46 +531,57 @@ public void testLeaderAcceptPreVoteFromObserver() throws 
Exception {
         context.assertSentVoteResponse(Errors.NONE, epoch, 
OptionalInt.of(localId), false);
     }
 
-    @Test
-    public void testHandlePreVoteRequestAsResigned() throws Exception {
+    @ParameterizedTest
+    @EnumSource(value = KRaftVersion.class)
+    public void testHandlePreVoteRequestAsResigned(KRaftVersion kraftVersion) 
throws Exception {
         int localId = randomReplicaId();
+        ReplicaKey localKey = replicaKey(localId, true);
         ReplicaKey otherNodeKey = replicaKey(localId + 1, true);
-        Set<Integer> voters = Set.of(localId, otherNodeKey.id());
 
-        RaftClientTestContext context = new 
RaftClientTestContext.Builder(localId, voters)
-            .withKip853Rpc(true)
+        RaftClientTestContext context = new RaftClientTestContext.Builder(
+            localKey,
+            VoterSetTest.voterSet(Stream.of(localKey, otherNodeKey)),
+            kraftVersion
+        )
+            .withRaftProtocol(KIP_996_PROTOCOL)
             .build();
-        context.becomeLeader();
+        context.unattachedToLeader();
         context.client.quorum().transitionToResigned(Collections.emptyList());
         assertTrue(context.client.quorum().isResigned());
 
         // resigned should grant pre-vote requests with the same epoch if log 
is up-to-date
         int epoch = context.currentEpoch();
-        context.deliverRequest(context.preVoteRequest(epoch, otherNodeKey, 
epoch, 1));
+        context.deliverRequest(context.preVoteRequest(epoch, otherNodeKey, 
epoch, 3));

Review Comment:
   yep, I decided to just use an LEO of 3 for both cases as to not 
overcomplicate (and because this difference is highlighted and tested in other 
KafkaRaftClientTests which focus more on fetch/offset validation) - I can add a 
conditional though if you think it's worth it



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