Browse Source

etcdserver: not push ready to readyNode automatically

Yicheng Qin 11 years ago
parent
commit
b8e59a3c6a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      etcdserver/server_test.go

+ 3 - 3
etcdserver/server_test.go

@@ -508,7 +508,7 @@ func TestTriggerSnap(t *testing.T) {
 // TestRecvSnapshot tests when it receives a snapshot from raft leader,
 // TestRecvSnapshot tests when it receives a snapshot from raft leader,
 // it should trigger storage.SaveSnap and also store.Recover.
 // it should trigger storage.SaveSnap and also store.Recover.
 func TestRecvSnapshot(t *testing.T) {
 func TestRecvSnapshot(t *testing.T) {
-	n := newReadyNode(raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}})
+	n := newReadyNode()
 	st := &storeRecorder{}
 	st := &storeRecorder{}
 	p := &storageRecorder{}
 	p := &storageRecorder{}
 	s := &EtcdServer{
 	s := &EtcdServer{
@@ -519,6 +519,7 @@ func TestRecvSnapshot(t *testing.T) {
 	}
 	}
 
 
 	s.Start()
 	s.Start()
+	n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
 	// make goroutines move forward to receive snapshot
 	// make goroutines move forward to receive snapshot
 	testutil.ForceGosched()
 	testutil.ForceGosched()
 	s.Stop()
 	s.Stop()
@@ -669,9 +670,8 @@ type readyNode struct {
 	readyc chan raft.Ready
 	readyc chan raft.Ready
 }
 }
 
 
-func newReadyNode(ready raft.Ready) *readyNode {
+func newReadyNode() *readyNode {
 	readyc := make(chan raft.Ready, 1)
 	readyc := make(chan raft.Ready, 1)
-	readyc <- ready
 	return &readyNode{readyc: readyc}
 	return &readyNode{readyc: readyc}
 }
 }
 func (n *readyNode) Tick()                                              {}
 func (n *readyNode) Tick()                                              {}