You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sh...@apache.org on 2020/05/28 09:00:56 UTC

[incubator-ratis] branch master updated: RATIS-900. Fix Failed UT: RaftExceptionBaseTest.testHandleNotLeaderAndIOException (#112)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 20bebaf  RATIS-900. Fix Failed UT: RaftExceptionBaseTest.testHandleNotLeaderAndIOException (#112)
20bebaf is described below

commit 20bebaf596536d7f69c4dce964e01ecd25aae78c
Author: runzhiwang <51...@users.noreply.github.com>
AuthorDate: Thu May 28 16:59:51 2020 +0800

    RATIS-900. Fix Failed UT: RaftExceptionBaseTest.testHandleNotLeaderAndIOException (#112)
---
 .../java/org/apache/ratis/RaftExceptionBaseTest.java    | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/ratis-server/src/test/java/org/apache/ratis/RaftExceptionBaseTest.java b/ratis-server/src/test/java/org/apache/ratis/RaftExceptionBaseTest.java
index 89653af..b0c2214 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftExceptionBaseTest.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftExceptionBaseTest.java
@@ -55,18 +55,10 @@ public abstract class RaftExceptionBaseTest<CLUSTER extends MiniRaftCluster>
 
   @Test
   public void testHandleNotLeaderException() throws Exception {
-    runWithNewCluster(NUM_PEERS, cluster -> runTestHandleNotLeaderException(false, cluster));
+    runWithNewCluster(NUM_PEERS, cluster -> runTestHandleNotLeaderException(cluster));
   }
 
-  /**
-   * Test handle both IOException and NotLeaderException
-   */
-  @Test
-  public void testHandleNotLeaderAndIOException() throws Exception {
-    runWithNewCluster(NUM_PEERS, cluster -> runTestHandleNotLeaderException(true, cluster));
-  }
-
-  void runTestHandleNotLeaderException(boolean killNewLeader, CLUSTER cluster) throws Exception {
+  void runTestHandleNotLeaderException(CLUSTER cluster) throws Exception {
     final RaftPeerId oldLeader = RaftTestUtil.waitForLeader(cluster).getId();
     try(final RaftClient client = cluster.createClient(oldLeader)) {
       sendMessage("m1", client);
@@ -74,11 +66,6 @@ public abstract class RaftExceptionBaseTest<CLUSTER extends MiniRaftCluster>
       // enforce leader change
       final RaftPeerId newLeader = RaftTestUtil.changeLeader(cluster, oldLeader);
 
-      if (killNewLeader) {
-        // kill the new leader
-        cluster.killServer(newLeader);
-      }
-
       final RaftClientRpc rpc = client.getClientRpc();
       JavaUtils.attemptRepeatedly(() -> assertNotLeaderException(newLeader, "m2", oldLeader, rpc, cluster),
           10, ONE_SECOND, "assertNotLeaderException", LOG);