use of com.hazelcast.cp.internal.raft.impl.testing.LocalRaftGroup in project hazelcast by hazelcast.
the class LocalRaftTest method when_leaderStaysInMinorityDuringSplit_thenItMergesBackSuccessfully.
@Test
public void when_leaderStaysInMinorityDuringSplit_thenItMergesBackSuccessfully() {
int nodeCount = 5;
group = new LocalRaftGroup(nodeCount);
group.start();
RaftEndpoint leaderEndpoint = group.waitUntilLeaderElected().getLocalMember();
int[] split = group.createMajoritySplitIndexes(false);
group.split(split);
assertTrueEventually(() -> {
for (int ix : split) {
RaftEndpoint newLeader = getLeaderMember(group.getNode(ix));
assertNotNull(newLeader);
assertNotEquals(leaderEndpoint, newLeader);
}
});
assertTrueEventually(() -> {
for (int i = 0; i < nodeCount; i++) {
if (Arrays.binarySearch(split, i) < 0) {
assertNull(getLeaderMember(group.getNode(i)));
}
}
});
group.merge();
group.waitUntilLeaderElected();
}
use of com.hazelcast.cp.internal.raft.impl.testing.LocalRaftGroup in project hazelcast by hazelcast.
the class LocalRaftTest method when_leaderStaysInMajorityDuringSplit_thenItMergesBackSuccessfully.
@Test
public void when_leaderStaysInMajorityDuringSplit_thenItMergesBackSuccessfully() {
group = new LocalRaftGroup(5);
group.start();
group.waitUntilLeaderElected();
int[] split = group.createMinoritySplitIndexes(false);
group.split(split);
assertTrueEventually(() -> {
for (int ix : split) {
assertNull(getLeaderMember(group.getNode(ix)));
}
});
group.merge();
group.waitUntilLeaderElected();
}
Aggregations