src/core/Instance_test.cpp
// TODO: not vote for candidate with fewer log
not vote for candidate with fewer log
not vote for candidate with fewer log
TEST(Follower, TransformToCandidate) {
    MockRPCService service;
    Instance instance("test", service.get_client("test"));
    __tick = 500;
    instance.start();
    __tick = 600;
    instance.update();
    EXPECT_EQ(instance.role, Role::FOLLOWER);
    __tick = 1000;
    instance.update();
    EXPECT_EQ(instance.role, Role::CANDIDATE);
}
TEST ( Follower , TransformToCandidate ) { MockRPCService service ; Instance instance ( " " , service . get_client ( " " ) ) ; __tick = 500 ; instance . start ( ) ; __tick = 600 ; instance . update ( ) ; EXPECT_EQ ( instance . role , Role :: FOLLOWER ) ; __tick = 1000 ; instance . update ( ) ; EXPECT_EQ ( instance . role , Role :: CANDIDATE ) ; }
TODO: not vote for candidate with fewer log
TODO : not vote for candidate with fewer log