Merge pull request #1586 from xiangli-cmu/fix_node

*: add Advance interface to raft.Node
This commit is contained in:
Xiang Li
2014-11-05 15:09:51 -08:00
7 changed files with 114 additions and 28 deletions

View File

@@ -26,12 +26,16 @@ func BenchmarkOneNode(b *testing.B) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
n := StartNode(1, []Peer{{ID: 1}}, 0, 0)
n := newNode()
r := newRaft(1, []uint64{1}, 10, 1)
go n.run(r)
defer n.Stop()
n.Campaign(ctx)
for i := 0; i < b.N; i++ {
<-n.Ready()
n.Advance()
n.Propose(ctx, []byte("foo"))
}
rd := <-n.Ready()