use of org.apache.ignite.raft.jraft.rpc.RpcContext in project ignite-3 by apache.
the class AppendEntriesRequestProcessorTest method testTooManyPendingResponses.
@Test
public void testTooManyPendingResponses() {
final PeerId peer = mockNode();
nodeManager.get(this.groupId, peer).getRaftOptions().setMaxReplicatorInflightMsgs(2);
final RpcContext asyncContext = Mockito.mock(RpcContext.class);
final AppendEntriesRequestProcessor processor = (AppendEntriesRequestProcessor) newProcessor();
final PeerPair pair = processor.pairOf(this.peerIdStr, this.serverId);
final PingRequest msg = TestUtils.createPingRequest();
final PeerRequestContext ctx = processor.getOrCreatePeerRequestContext(this.groupId, pair, nodeManager);
assertNotNull(ctx);
processor.sendSequenceResponse(this.groupId, pair, 1, asyncContext, msg);
processor.sendSequenceResponse(this.groupId, pair, 2, asyncContext, msg);
processor.sendSequenceResponse(this.groupId, pair, 3, asyncContext, msg);
Mockito.verify(asyncContext, Mockito.never()).sendResponse(msg);
final PeerRequestContext newCtx = processor.getOrCreatePeerRequestContext(this.groupId, pair, nodeManager);
assertNotNull(newCtx);
assertNotSame(ctx, newCtx);
}
Aggregations