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 2021/04/25 09:24:08 UTC

[ratis] branch master updated: Ratis 1363 Intermittent failure in TestInstallSnapshotNotificationWithGrpc (#466)

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 37c3b13  Ratis 1363 Intermittent failure in TestInstallSnapshotNotificationWithGrpc (#466)
37c3b13 is described below

commit 37c3b13de094d31a6c674666cab07edf169d0663
Author: Roni Juntunen <18...@users.noreply.github.com>
AuthorDate: Sun Apr 25 12:24:00 2021 +0300

    Ratis 1363 Intermittent failure in TestInstallSnapshotNotificationWithGrpc (#466)
---
 .../org/apache/ratis/InstallSnapshotNotificationTests.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
index 675ee55..38f2e43 100644
--- a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
@@ -275,6 +275,11 @@ public abstract class InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
         }
       }
 
+      // Wait until index has been updated
+      RaftTestUtil.waitFor(
+              () -> cluster.getLeader().getStateMachine().getLastAppliedTermIndex().getIndex() == 20,
+               300, 15000);
+
       // Take snapshot and check result.
       long snapshotIndex = cluster.getLeader().getStateMachine().takeSnapshot();
       Assert.assertEquals(20, snapshotIndex);
@@ -332,9 +337,10 @@ public abstract class InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
 
       // Make sure leader and followers are still up to date.
       for (RaftServer.Division follower : cluster.getFollowers()) {
-        Assert.assertEquals(
-            leader.getRaftLog().getNextIndex(),
-            follower.getRaftLog().getNextIndex());
+        // Give follower slightly time to catch up
+        RaftTestUtil.waitFor(
+                () -> leader.getRaftLog().getNextIndex() == follower.getRaftLog().getNextIndex(),
+                300, 15000);
       }
 
       // Make sure each new peer got one snapshot notification.