Cyrill commented on code in PR #7813:
URL: https://github.com/apache/ignite-3/pull/7813#discussion_r3044800636
##########
modules/raft/src/test/java/org/apache/ignite/internal/raft/client/PhysicalTopologyAwareRaftGroupServiceRunTest.java:
##########
@@ -334,43 +355,31 @@ void testZeroTimeoutTriesAllPeersBeforeFailing() {
}
/**
- * Tests that with Long.MAX_VALUE timeout, all peers are tried first, then
waits for leader, and succeeds when leader appears.
+ * Tests that with Long.MAX_VALUE timeout, run() discovers the leader via
GetLeaderRequest
+ * and then succeeds with the actual command.
+ *
+ * <p>With the new behavior, run() calls refreshAndGetLeaderWithTerm()
first when leader is unknown.
+ * The GetLeaderRequest retries until leader is discovered, then the
WriteActionRequest is sent.
*/
@Test
void testInfiniteTimeoutWaitsForLeaderAndSucceeds() throws Exception {
- // First 3 WriteActionRequest calls return EPERM (no leader), then
success after leader appears.
- AtomicInteger callCount = new AtomicInteger(0);
- CountDownLatch allPeersTried = new CountDownLatch(3);
-
- when(messagingService.invoke(
- any(InternalClusterNode.class),
- argThat(this::isTestWriteCommand),
- anyLong()
- )).thenAnswer(invocation -> {
- if (callCount.incrementAndGet() <= 3) {
- allPeersTried.countDown();
- return completedFuture(FACTORY.errorResponse()
- .errorCode(RaftError.EPERM.getNumber())
- .build());
- }
- return completedFuture(FACTORY.actionResponse().result(new
TestResponse()).build());
- });
+ // WriteActionRequest always succeeds (sent after leader is
discovered).
+ mockUserInputSuccess();
Review Comment:
Changed test
--
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]