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/incubator-ratis.git
The following commit(s) were added to refs/heads/master by this push:
new a80fc6c RATIS-1101. Fix Failed UT:
RaftBasicTests.runTestOldLeaderNotCommit:IndexOutOfBounds (#229). Contributed
by Rui Wang
a80fc6c is described below
commit a80fc6cf47eed1aaa977577c8e12ed23d5c949a2
Author: Rui Wang <[email protected]>
AuthorDate: Wed Oct 21 07:37:46 2020 -0700
RATIS-1101. Fix Failed UT:
RaftBasicTests.runTestOldLeaderNotCommit:IndexOutOfBounds (#229). Contributed
by Rui Wang
---
.../src/test/java/org/apache/ratis/RaftBasicTests.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
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 48d310b..42fd159 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftBasicTests.java
@@ -228,9 +228,14 @@ public abstract class RaftBasicTests<CLUSTER extends
MiniRaftCluster>
List<RaftServerImpl> followers = cluster.getFollowers();
final RaftServerImpl followerToCommit = followers.get(0);
- for (int i = 1; i < NUM_SERVERS - 1; i++) {
- RaftServerImpl follower = followers.get(i);
- cluster.killServer(follower.getId());
+ try {
+ for (int i = 1; i < NUM_SERVERS - 1; i++) {
+ RaftServerImpl follower = followers.get(i);
+ cluster.killServer(follower.getId());
+ }
+ } catch (IndexOutOfBoundsException e) {
+ throw new org.junit.AssumptionViolatedException("The assumption is
follower.size() = NUM_SERVERS - 1, "
+ + "actual NUM_SERVERS is " + NUM_SERVERS + ", and actual
follower.size() is " + followers.size(), e);
}
SimpleMessage[] messages = SimpleMessage.create(1);