mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: add a test for node.Tick
This commit is contained in:
parent
f1f796f2fc
commit
45c36a0808
@ -140,6 +140,20 @@ func TestBlockProposal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestNodeTick ensures that node.Tick() will increase the
|
||||||
|
// elapsed of the underly raft state machine.
|
||||||
|
func TestNodeTick(t *testing.T) {
|
||||||
|
n := newNode()
|
||||||
|
r := newRaft(1, []uint64{1}, 10, 1)
|
||||||
|
go n.run(r)
|
||||||
|
elapsed := r.elapsed
|
||||||
|
n.Tick()
|
||||||
|
n.Stop()
|
||||||
|
if r.elapsed != elapsed+1 {
|
||||||
|
t.Errorf("elapsed = %d, want %d", r.elapsed, elapsed+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestReadyContainUpdates(t *testing.T) {
|
func TestReadyContainUpdates(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
rd Ready
|
rd Ready
|
||||||
|
Loading…
x
Reference in New Issue
Block a user