You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/11/04 10:09:21 UTC

[GitHub] [incubator-ratis] szetszwo commented on a change in pull request #252: RATIS-1112. Ensure a node doesn't get reelected as a leader if it vol…

szetszwo commented on a change in pull request #252:
URL: https://github.com/apache/incubator-ratis/pull/252#discussion_r517231573



##########
File path: ratis-server/src/test/java/org/apache/ratis/server/impl/LeaderElectionTests.java
##########
@@ -96,6 +96,27 @@ public void testChangeLeader() throws Exception {
     cluster.shutdown();
   }
 
+  @Test
+  public void testLostMajorityHeartbeats() throws Exception {
+    runWithNewCluster(3, this::runTestLostMajorityHeartbeats);
+  }
+
+  void runTestLostMajorityHeartbeats(CLUSTER cluster) throws Exception {
+    final RaftServerImpl leader = waitForLeader(cluster);
+    try {
+      isolate(cluster, leader.getId());
+      Thread.sleep(leader.getMaxTimeoutMs());
+      Thread.sleep(leader.getMaxTimeoutMs());

Review comment:
       Yes.  The test may fail if it only sleeps once.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org