kevin-wu24 commented on code in PR #19982:
URL: https://github.com/apache/kafka/pull/19982#discussion_r2198341063
##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientReconfigTest.java:
##########
@@ -339,27 +340,80 @@ public void testAddVoter() throws Exception {
Map.of(context.channel.listenerName(), newAddress)
);
- // Show that the new voter is not currently a voter
- assertFalse(context.client.quorum().isVoter(newVoter));
+ prepareLeaderToReceiveAddVoter(context, epoch, local, follower,
newVoter);
- // Establish a HWM and fence previous leaders
- context.deliverRequest(
- context.fetchRequest(epoch, follower,
context.log.endOffset().offset(), epoch, 0)
- );
+ // Attempt to add new voter to the quorum
+ context.deliverRequest(context.addVoterRequest(Integer.MAX_VALUE,
newVoter, newListeners));
+
+ completeApiVersionsForAddVoter(context, newVoter, newAddress);
Review Comment:
In general, my motivation for grouping code in this way into helpers was to
make the test read like the high level description of how AddRaftVoter RPC
works:
- `prepareLeaderToReceiveAddVoter` gets the local replica to a state where
the context can send the AddRaftVoter RPC and have it trigger an API versions
request
- The test context delivers an AddRaftVoter RPC
- `completeApiVersionsForAddVoter` completes the API versions RPC contained
as part of the AddRaftVoter RPC loop
- `commitNewVoterSetForAddVoter` completes the fetch RPC that is needed to
complete AddRaftVoter RPC
Let me know if that makes sense to you.
--
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]