anjy7 opened a new pull request, #23136:
URL: https://github.com/apache/kafka/pull/23136

   ### What
   Two extractions out of RaftClientTestContext:
   
   1. SharedRaftClientContext (new abstract base) : holds the mock client 
wiring (KafkaRaftClient, MockLog, MockNetworkChannel, MockQuorumStateStore, 
MockTime, voter set) plus the helpers that build/deliver RPC requests and 
responses, poll the client, collect the requests it sends, and drive it through 
elections and other state transitions. RaftClientTestContext now extends it.
   2. RaftClientContextBuilder (new top-level class) : the former nested 
RaftClientTestContext.Builder, lifted out unchanged.
   
   ### How assertions are handled
   
   The helpers in SharedRaftClientContext are assertion-free. 
RaftClientTestContext overrides the relevant ones to add the protocol 
assertions, calling super(...) for the shared work — e.g. collectVoteRequests() 
collects in the base and the override validates each request; 
advanceLocalLeaderHighWatermarkToLogEndOffset() does the fetch/HWM work in the 
base and the override asserts the leader and each response. This keeps the 
assertion behavior for tests identical while isolating it from the shared 
machinery.
   
   
   ### Why
   This separates the reusable raft-client harness from the test-specific 
assertions. It’s groundwork for a benchmark context that reuses the 
assertion-free base, which will be used by JMH benchmarks in KRaft.
   


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

Reply via email to