You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2023/03/04 02:55:53 UTC

[ratis] branch master updated: RATIS-1806. Further fix for TestLogAppenderWithGrpc#testPendingLimits (#841)

This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 8caed1331 RATIS-1806. Further fix for TestLogAppenderWithGrpc#testPendingLimits (#841)
8caed1331 is described below

commit 8caed1331878908eecd7ddc758fbb19ed496072b
Author: Kaijie Chen <ck...@apache.org>
AuthorDate: Sat Mar 4 10:55:47 2023 +0800

    RATIS-1806. Further fix for TestLogAppenderWithGrpc#testPendingLimits (#841)
---
 .../test/java/org/apache/ratis/grpc/TestLogAppenderWithGrpc.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ratis-test/src/test/java/org/apache/ratis/grpc/TestLogAppenderWithGrpc.java b/ratis-test/src/test/java/org/apache/ratis/grpc/TestLogAppenderWithGrpc.java
index b6676541d..c0d102f95 100644
--- a/ratis-test/src/test/java/org/apache/ratis/grpc/TestLogAppenderWithGrpc.java
+++ b/ratis-test/src/test/java/org/apache/ratis/grpc/TestLogAppenderWithGrpc.java
@@ -18,6 +18,7 @@
 package org.apache.ratis.grpc;
 
 import org.apache.ratis.LogAppenderTests;
+import org.apache.ratis.proto.RaftProtos;
 import org.apache.ratis.server.impl.MiniRaftCluster;
 import org.apache.ratis.RaftTestUtil;
 import org.apache.ratis.client.RaftClient;
@@ -76,8 +77,9 @@ public class TestLogAppenderWithGrpc
 
     // client and leader setup
     try (final RaftClient client = cluster.createClient(cluster.getGroup())) {
-      client.io().send(new RaftTestUtil.SimpleMessage("m"));
       final RaftServer.Division leader = waitForLeader(cluster);
+      RaftClientReply reply = client.io().send(new RaftTestUtil.SimpleMessage("m"));
+      client.io().watch(reply.getLogIndex(), RaftProtos.ReplicationLevel.ALL_COMMITTED);
       long initialNextIndex = RaftServerTestUtil.getNextIndex(leader);
 
       for (RaftServer.Division server : cluster.getFollowers()) {
@@ -94,8 +96,7 @@ public class TestLogAppenderWithGrpc
           // Verify nextIndex does not progress due to pendingRequests limit
           Assert.assertEquals(initialNextIndex + maxAppends, nextIndex);
         }
-      }, 5, ONE_SECOND, "matching nextIndex", LOG);
-      ONE_SECOND.sleep();
+      }, 10, ONE_SECOND, "matching nextIndex", LOG);
       for (RaftServer.Division server : cluster.getFollowers()) {
         // unblock the appends in the follower
         SimpleStateMachine4Testing.get(server).unblockWriteStateMachineData();