mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: add TestRecvSlowSnapshot
This commit is contained in:
parent
b8e59a3c6a
commit
fac38aad33
@ -534,6 +534,34 @@ func TestRecvSnapshot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRecvSlowSnapshot tests that slow snapshot will not be applied
|
||||
// to store.
|
||||
func TestRecvSlowSnapshot(t *testing.T) {
|
||||
n := newReadyNode()
|
||||
st := &storeRecorder{}
|
||||
s := &EtcdServer{
|
||||
Store: st,
|
||||
Send: func(_ []raftpb.Message) {},
|
||||
Storage: &storageRecorder{},
|
||||
Node: n,
|
||||
}
|
||||
|
||||
s.Start()
|
||||
n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
|
||||
// make goroutines move forward to receive snapshot
|
||||
testutil.ForceGosched()
|
||||
action := st.Action()
|
||||
|
||||
n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
|
||||
// make goroutines move forward to receive snapshot
|
||||
testutil.ForceGosched()
|
||||
s.Stop()
|
||||
|
||||
if g := st.Action(); !reflect.DeepEqual(g, action) {
|
||||
t.Errorf("store action = %v, want %v", g, action)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: test wait trigger correctness in multi-server case
|
||||
|
||||
func TestGetBool(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user