diff --git a/raft/raft_paper_test.go b/raft/raft_paper_test.go index f9846b36..ad200ed4 100644 --- a/raft/raft_paper_test.go +++ b/raft/raft_paper_test.go @@ -181,11 +181,6 @@ func TestLeaderElectionInOneRoundRPC2AA(t *testing.T) { {5, map[uint64]bool{2: true, 3: true, 4: true}, StateLeader}, {5, map[uint64]bool{2: true, 3: true}, StateLeader}, - // return to follower state if it receives vote denial from a majority - {3, map[uint64]bool{2: false, 3: false}, StateFollower}, - {5, map[uint64]bool{2: false, 3: false, 4: false, 5: false}, StateFollower}, - {5, map[uint64]bool{2: true, 3: false, 4: false, 5: false}, StateFollower}, - // stay in candidate if it does not obtain the majority {3, map[uint64]bool{}, StateCandidate}, {5, map[uint64]bool{2: true}, StateCandidate}, diff --git a/raft/raft_test.go b/raft/raft_test.go index 68cfe877..febe719f 100644 --- a/raft/raft_test.go +++ b/raft/raft_test.go @@ -66,8 +66,6 @@ func TestProgressLeader2AB(t *testing.T) { func TestLeaderElection2AA(t *testing.T) { var cfg func(*Config) - candState := StateCandidate - candTerm := uint64(1) tests := []struct { *network state StateType @@ -75,15 +73,9 @@ func TestLeaderElection2AA(t *testing.T) { }{ {newNetworkWithConfig(cfg, nil, nil, nil), StateLeader, 1}, {newNetworkWithConfig(cfg, nil, nil, nopStepper), StateLeader, 1}, - {newNetworkWithConfig(cfg, nil, nopStepper, nopStepper), candState, candTerm}, - {newNetworkWithConfig(cfg, nil, nopStepper, nopStepper, nil), candState, candTerm}, + {newNetworkWithConfig(cfg, nil, nopStepper, nopStepper), StateCandidate, 1}, + {newNetworkWithConfig(cfg, nil, nopStepper, nopStepper, nil), StateCandidate, 1}, {newNetworkWithConfig(cfg, nil, nopStepper, nopStepper, nil, nil), StateLeader, 1}, - - // three logs further along than 0, but in the same term so rejections - // are returned instead of the votes being ignored. - {newNetworkWithConfig(cfg, - nil, entsWithConfig(cfg, 1), entsWithConfig(cfg, 1), entsWithConfig(cfg, 1, 1), nil), - StateFollower, 1}, } for i, tt := range tests {