etcdserver/test: synchronously wait on TestApplySnapshotAndCommittedEntries

Replaces the RecorderBuffered with a RecorderStream so Wait will block
waiting for updates to the etcdserver store.

Fixes #4296
This commit is contained in:
Anthony Romano
2016-01-26 20:57:21 -08:00
parent 4c024b305f
commit 64596f0c49
2 changed files with 11 additions and 6 deletions

View File

@ -1019,7 +1019,7 @@ func TestRecvSnapshot(t *testing.T) {
// first and then committed entries. // first and then committed entries.
func TestApplySnapshotAndCommittedEntries(t *testing.T) { func TestApplySnapshotAndCommittedEntries(t *testing.T) {
n := newNopReadyNode() n := newNopReadyNode()
st := store.NewRecorder() st := store.NewRecorderStream()
cl := newCluster("abc") cl := newCluster("abc")
cl.SetStore(store.New()) cl.SetStore(store.New())
storage := raft.NewMemoryStorage() storage := raft.NewMemoryStorage()

View File

@ -756,13 +756,17 @@ type StoreRecorder struct {
// It always returns invalid empty response and no error. // It always returns invalid empty response and no error.
type storeRecorder struct { type storeRecorder struct {
Store Store
testutil.RecorderBuffered testutil.Recorder
} }
func NewNop() Store { return &storeRecorder{} } func NewNop() Store { return &storeRecorder{Recorder: &testutil.RecorderBuffered{}} }
func NewRecorder() *StoreRecorder { func NewRecorder() *StoreRecorder {
sr := &storeRecorder{} sr := &storeRecorder{Recorder: &testutil.RecorderBuffered{}}
return &StoreRecorder{Store: sr, Recorder: sr} return &StoreRecorder{Store: sr, Recorder: sr.Recorder}
}
func NewRecorderStream() *StoreRecorder {
sr := &storeRecorder{Recorder: testutil.NewRecorderStream()}
return &StoreRecorder{Store: sr, Recorder: sr.Recorder}
} }
func (s *storeRecorder) Version() int { return 0 } func (s *storeRecorder) Version() int { return 0 }
@ -856,7 +860,8 @@ type errStoreRecorder struct {
func NewErrRecorder(err error) *StoreRecorder { func NewErrRecorder(err error) *StoreRecorder {
sr := &errStoreRecorder{err: err} sr := &errStoreRecorder{err: err}
return &StoreRecorder{Store: sr, Recorder: sr} sr.Recorder = &testutil.RecorderBuffered{}
return &StoreRecorder{Store: sr, Recorder: sr.Recorder}
} }
func (s *errStoreRecorder) Get(path string, recursive, sorted bool) (*Event, error) { func (s *errStoreRecorder) Get(path string, recursive, sorted bool) (*Event, error) {