|
@@ -775,9 +775,10 @@ func TestRecvMsgBeat(t *testing.T) {
|
|
|
|
|
|
|
|
func TestRestore(t *testing.T) {
|
|
func TestRestore(t *testing.T) {
|
|
|
s := Snapshot{
|
|
s := Snapshot{
|
|
|
- Index: defaultCompactThreshold + 1,
|
|
|
|
|
- Term: defaultCompactThreshold + 1,
|
|
|
|
|
- Nodes: []int64{0, 1, 2},
|
|
|
|
|
|
|
+ ClusterId: 0xBEEF,
|
|
|
|
|
+ Index: defaultCompactThreshold + 1,
|
|
|
|
|
+ Term: defaultCompactThreshold + 1,
|
|
|
|
|
+ Nodes: []int64{0, 1, 2},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sm := newStateMachine(0, []int64{0, 1})
|
|
sm := newStateMachine(0, []int64{0, 1})
|
|
@@ -785,6 +786,9 @@ func TestRestore(t *testing.T) {
|
|
|
t.Fatal("restore fail, want succeed")
|
|
t.Fatal("restore fail, want succeed")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if sm.clusterId != s.ClusterId {
|
|
|
|
|
+ t.Errorf("sm.cluster = %x, want %x", sm.clusterId, s.ClusterId)
|
|
|
|
|
+ }
|
|
|
if sm.raftLog.lastIndex() != s.Index {
|
|
if sm.raftLog.lastIndex() != s.Index {
|
|
|
t.Errorf("log.lastIndex = %d, want %d", sm.raftLog.lastIndex(), s.Index)
|
|
t.Errorf("log.lastIndex = %d, want %d", sm.raftLog.lastIndex(), s.Index)
|
|
|
}
|
|
}
|