consensus-raft/src/test/java/com/mboysan/consensus/RaftNodeTest.java
/**
     * Tests appending log entries when everything is running smoothly.
     */
Tests appending log entries when everything is running smoothly.
Tests appending log entries when everything is running smoothly .
@Test
    void testWhenAllConnectedThenAppendSucceeds() throws Exception {
        init(3);
        int leaderId = assertOneLeader();
        List<String> expectedCommands = Arrays.asList("cmd0", "cmd1", "cmd3");
        assertTrue(getNode(leaderId).append(expectedCommands.get(0)).get());
        assertTrue(getNode(leaderId).append(expectedCommands.get(1)).get());
        assertTrue(getNode(leaderId).append(expectedCommands.get(2)).get());
        assertLeaderNotChanged(leaderId);
        assertLogsEquals(expectedCommands);
        advanceTimeForElections();  
        assertLeaderNotChanged(leaderId);
        assertLogsEquals(expectedCommands);
    }
@ Test void testWhenAllConnectedThenAppendSucceeds ( ) throws Exception { init ( 3 ) ; int leaderId = assertOneLeader ( ) ; List < String > expectedCommands = Arrays . asList ( "cmd0" , "cmd1" , "cmd3" ) ; assertTrue ( getNode ( leaderId ) . append ( expectedCommands . get ( 0 ) ) . get ( ) ) ; assertTrue ( getNode ( leaderId ) . append ( expectedCommands . get ( 1 ) ) . get ( ) ) ; assertTrue ( getNode ( leaderId ) . append ( expectedCommands . get ( 2 ) ) . get ( ) ) ; assertLeaderNotChanged ( leaderId ) ; assertLogsEquals ( expectedCommands ) ; advanceTimeForElections ( ) ; assertLeaderNotChanged ( leaderId ) ; assertLogsEquals ( expectedCommands ) ; }
Tests appending log entries when everything is running smoothly.
Tests appending log entries when everything is running smoothly .
// everything should stay the same even after some time passes