Skip to content

Commit

Permalink
fix talent-plan#171 let newRaft take care of peers and Prs (talent-pl…
Browse files Browse the repository at this point in the history
…an#172)

* let newRaft take care of peers and Prs
  • Loading branch information
Lin ZiHao authored May 14, 2020
1 parent 38dfb05 commit e01d729
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions raft/raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func TestLeaderCycle2AA(t *testing.T) {
// log entries, and must overwrite higher-term log entries with
// lower-term ones.
func TestLeaderElectionOverwriteNewerLogs2AB(t *testing.T) {
var cfg func(*Config)
cfg := func(c *Config) {
c.peers = idsBySize(5)
}
// This network represents the results of the following sequence of
// events:
// - Node 1 won the election in term 1.
Expand Down Expand Up @@ -1594,10 +1596,6 @@ func newNetworkWithConfig(configFunc func(*Config), peers ...stateMachine) *netw
npeers[id] = sm
case *Raft:
v.id = id
v.Prs = make(map[uint64]*Progress)
for i := 0; i < size; i++ {
v.Prs[peerAddrs[i]] = &Progress{}
}
npeers[id] = v
case *blackHole:
npeers[id] = v
Expand Down

0 comments on commit e01d729

Please sign in to comment.