Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions ratis-server/src/test/java/org/apache/ratis/RaftAsyncTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,22 +380,19 @@ void runTestWriteAsyncCustomReplicationLevel(CLUSTER cluster) throws Exception {
try (RaftClient client = cluster.createClient(leader)) {

// submit some messages
final List<CompletableFuture<RaftClientReply>> futures = new ArrayList<>();
for (int i = 0; i < numMessages; i++) {
final String s = "" + i;
LOG.info("sendAsync with ALL_COMMITTED " + s);
client.async().send(new SimpleMessage(s), ReplicationLevel.ALL_COMMITTED).whenComplete((reply, exception) -> {
if (exception != null) {
LOG.error("Failed to send message " + s, exception);
// reply should be null in case of exception
Assertions.assertNull(reply);
return;
}
Assertions.assertTrue(reply.isSuccess());
Assertions.assertNull(reply.getException());
// verify that all servers have caught up to log index when the reply is returned
reply.getCommitInfos().forEach(commitInfoProto ->
Assertions.assertTrue(commitInfoProto.getCommitIndex() >= reply.getLogIndex()));
});
futures.add(client.async().send(new SimpleMessage(s), ReplicationLevel.ALL_COMMITTED));
}
for (CompletableFuture<RaftClientReply> f : futures) {
final RaftClientReply reply = getWithDefaultTimeout(f);
Comment thread
smengcl marked this conversation as resolved.
Assertions.assertTrue(reply.isSuccess());
Assertions.assertNull(reply.getException());
// verify that all servers have caught up to log index when the reply is returned
reply.getCommitInfos().forEach(commitInfoProto ->
Assertions.assertTrue(commitInfoProto.getCommitIndex() >= reply.getLogIndex()));
}
}
}
Expand Down
Loading