use of org.apache.ignite.raft.client.service.RaftGroupService in project ignite-3 by apache.
the class RaftGroupServiceTest method testAddLearners.
/**
* @throws Exception
*/
@Test
public void testAddLearners() throws Exception {
String groupId = "test";
List<String> addLearners = peersToIds(NODES.subList(1, 3));
when(messagingService.invoke(any(NetworkAddress.class), eq(FACTORY.addLearnersRequest().learnersList(addLearners).groupId(groupId).build()), anyLong())).then(invocation -> completedFuture(FACTORY.learnersOpResponse().newLearnersList(addLearners).build()));
mockLeaderRequest(false);
RaftGroupService service = RaftGroupServiceImpl.start(groupId, cluster, FACTORY, TIMEOUT, NODES.subList(0, 1), true, DELAY, executor).get(3, TimeUnit.SECONDS);
assertEquals(NODES.subList(0, 1), service.peers());
assertEquals(Collections.emptyList(), service.learners());
service.addLearners(NODES.subList(1, 3)).get();
assertEquals(NODES.subList(0, 1), service.peers());
assertEquals(NODES.subList(1, 3), service.learners());
}
Aggregations