jsancio commented on code in PR #18240:
URL: https://github.com/apache/kafka/pull/18240#discussion_r1917518120
##########
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:
Well, it is good to have self documented test (or code). You can make this
connection clear by using the local log end offset if you expect the logs to
match. E.g. `context.log.endOffset()`.
--
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]