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 2018/02/05 21:13:06 UTC

incubator-ratis git commit: RATIS-201. RaftBasicTests.testWithLoad should use RaftTestUtil.waitForLeader instead of cluster.getLeader(). Contributed by Lokesh Jain

Repository: incubator-ratis
Updated Branches:
  refs/heads/master 2d5365683 -> cb7e6d429


RATIS-201. RaftBasicTests.testWithLoad should use RaftTestUtil.waitForLeader instead of cluster.getLeader().  Contributed by Lokesh Jain


Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/cb7e6d42
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/cb7e6d42
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/cb7e6d42

Branch: refs/heads/master
Commit: cb7e6d42904ed91d960c8dd8c9e49d0f0461c228
Parents: 2d53656
Author: Tsz-Wo Nicholas Sze <sz...@hortonworks.com>
Authored: Mon Feb 5 13:12:17 2018 -0800
Committer: Tsz-Wo Nicholas Sze <sz...@hortonworks.com>
Committed: Mon Feb 5 13:12:17 2018 -0800

----------------------------------------------------------------------
 ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java | 2 +-
 ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/cb7e6d42/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java
----------------------------------------------------------------------
diff --git a/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java b/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java
index f4156d4..4fac472 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java
@@ -346,7 +346,7 @@ public abstract class RaftBasicTests extends BaseTest {
       lastStep.set(n);
       count++;
 
-      RaftServerImpl leader = cluster.getLeader();
+      RaftServerImpl leader = waitForLeader(cluster, true);
       if (leader != null) {
         RaftTestUtil.changeLeader(cluster, leader.getId());
       }

http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/cb7e6d42/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
----------------------------------------------------------------------
diff --git a/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java b/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
index c55445a..3d7f791 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
@@ -71,7 +71,6 @@ public interface RaftTestUtil {
     LOG.info(cluster.printServers(groupId));
     RaftServerImpl leader = null;
     for(int i = 0; leader == null && i < 10; i++) {
-      Thread.sleep(sleepTime);
       try {
         leader = cluster.getLeader(groupId);
       } catch(IllegalStateException e) {
@@ -79,6 +78,7 @@ public interface RaftTestUtil {
           throw e;
         }
       }
+      Thread.sleep(sleepTime);
     }
     LOG.info(cluster.printServers(groupId));
     return leader;