use of com.hazelcast.cp.exception.CannotReplicateException in project hazelcast by hazelcast.
the class MembershipChangeTest method when_leaderIsSteppingDown_then_itDoesNotAcceptNewAppends.
@Test
public void when_leaderIsSteppingDown_then_itDoesNotAcceptNewAppends() throws ExecutionException, InterruptedException {
group = new LocalRaftGroupBuilder(3).setAppendNopEntryOnLeaderElection(true).build();
group.start();
RaftNodeImpl leader = group.waitUntilLeaderElected();
RaftNodeImpl[] followers = group.getNodesExcept(leader.getLocalMember());
group.dropMessagesToMember(leader.getLocalMember(), followers[0].getLocalMember(), AppendRequest.class);
group.dropMessagesToMember(leader.getLocalMember(), followers[1].getLocalMember(), AppendRequest.class);
InternalCompletableFuture f1 = leader.replicateMembershipChange(leader.getLocalMember(), REMOVE);
InternalCompletableFuture f2 = leader.replicate(new PostponedResponseRaftRunnable());
assertFalse(f1.isDone());
assertTrueEventually(() -> assertTrue(f2.isDone()));
try {
f2.joinInternal();
fail();
} catch (CannotReplicateException ignored) {
}
}
use of com.hazelcast.cp.exception.CannotReplicateException in project hazelcast by hazelcast.
the class DestroyRaftGroupTest method when_destroyOpIsAppendedButNotCommitted_then_cannotAppendNewEntry.
@Test
public void when_destroyOpIsAppendedButNotCommitted_then_cannotAppendNewEntry() throws ExecutionException, InterruptedException {
group = newGroup(2);
group.start();
RaftNodeImpl leader = group.waitUntilLeaderElected();
RaftNodeImpl follower = group.getAnyFollowerNode();
group.dropAllMessagesToMember(leader.getLocalMember(), follower.getLocalMember());
leader.replicate(new DestroyRaftGroupCmd());
try {
leader.replicate(new ApplyRaftRunnable("val")).joinInternal();
fail();
} catch (CannotReplicateException ignored) {
}
}
Aggregations