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/02 04:35:07 UTC

[ratis] branch master updated: RATIS-1801. Fix flaky test of TestLogAppenderWithGrpc.testPendingLimits (#837)

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 ea76d62dc RATIS-1801. Fix flaky test of TestLogAppenderWithGrpc.testPendingLimits (#837)
ea76d62dc is described below

commit ea76d62dc5773ffcb7f141401309d94d7ea5a97c
Author: Angerszhuuuu <an...@gmail.com>
AuthorDate: Thu Mar 2 12:35:00 2023 +0800

    RATIS-1801. Fix flaky test of TestLogAppenderWithGrpc.testPendingLimits (#837)
---
 .../java/org/apache/ratis/grpc/TestLogAppenderWithGrpc.java   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 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 a91bc4d91..b6676541d 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
@@ -89,11 +89,12 @@ public class TestLogAppenderWithGrpc
         futures.add(client.async().send(new RaftTestUtil.SimpleMessage("m")));
       }
 
-      FIVE_SECONDS.sleep();
-      for (long nextIndex : leader.getInfo().getFollowerNextIndices()) {
-        // Verify nextIndex does not progress due to pendingRequests limit
-        Assert.assertEquals(initialNextIndex + maxAppends, nextIndex);
-      }
+      JavaUtils.attempt(() -> {
+        for (long nextIndex : leader.getInfo().getFollowerNextIndices()) {
+          // Verify nextIndex does not progress due to pendingRequests limit
+          Assert.assertEquals(initialNextIndex + maxAppends, nextIndex);
+        }
+      }, 5, ONE_SECOND, "matching nextIndex", LOG);
       ONE_SECOND.sleep();
       for (RaftServer.Division server : cluster.getFollowers()) {
         // unblock the appends in the follower