...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package mockwait
16
17 import (
18 "go.etcd.io/etcd/client/pkg/v3/testutil"
19 "go.etcd.io/etcd/pkg/v3/wait"
20 )
21
22 type WaitRecorder struct {
23 wait.Wait
24 testutil.Recorder
25 }
26
27 type waitRecorder struct {
28 testutil.RecorderBuffered
29 }
30
31 func NewRecorder() *WaitRecorder {
32 wr := &waitRecorder{}
33 return &WaitRecorder{Wait: wr, Recorder: wr}
34 }
35 func NewNop() wait.Wait { return NewRecorder() }
36
37 func (w *waitRecorder) Register(id uint64) <-chan interface{} {
38 w.Record(testutil.Action{Name: "Register"})
39 return nil
40 }
41 func (w *waitRecorder) Trigger(id uint64, x interface{}) {
42 w.Record(testutil.Action{Name: "Trigger"})
43 }
44
45 func (w *waitRecorder) IsRegistered(id uint64) bool {
46 panic("waitRecorder.IsRegistered() shouldn't be called")
47 }
48
View as plain text