consensus-raft/src/test/java/com/mboysan/consensus/RaftNodeTest.java
/**
     * Tests when the minority number of followers are killed, then the old leader still remains as the leader after
     * the dead followers are revived.
     */
Tests when the minority number of followers are killed, then the old leader still remains as the leader after
the dead followers are revived.
Tests when the minority number of followers are killed then the old leader still remains as the leader after the dead followers are revived .
@Test
    void testLeaderNotChanged() throws Exception {
        int numServers = 5;
        init(numServers);
        int leaderId = assertOneLeader();
        kill((leaderId + 1) % numServers);
        kill((leaderId + 2) % numServers);
        advanceTimeForElections();
        assertLeaderNotChanged(leaderId);
        revive((leaderId + 1) % numServers);
        revive((leaderId + 2) % numServers);
        advanceTimeForElections();
        assertLeaderNotChanged(leaderId);
        assertOneLeader();
    }
@ Test void testLeaderNotChanged ( ) throws Exception { int numServers = 5 ; init ( numServers ) ; int leaderId = assertOneLeader ( ) ; kill ( ( leaderId + 1 ) % numServers ) ; kill ( ( leaderId + 2 ) % numServers ) ; advanceTimeForElections ( ) ; assertLeaderNotChanged ( leaderId ) ; revive ( ( leaderId + 1 ) % numServers ) ; revive ( ( leaderId + 2 ) % numServers ) ; advanceTimeForElections ( ) ; assertLeaderNotChanged ( leaderId ) ; assertOneLeader ( ) ; }
Tests when the minority number of followers are killed, then the old leader still remains as the leader after
 the dead followers are revived.
Tests when the minority number of followers are killed then the old leader still remains as the leader after the dead followers are revived .