-
Notifications
You must be signed in to change notification settings - Fork 7
/
fake.go
29 lines (22 loc) · 875 Bytes
/
fake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package etcd
import (
"context"
clientv3 "go.etcd.io/etcd/client/v3"
)
type fakeClient struct {
memberListF func(context context.Context) (*clientv3.MemberListResponse, error)
memberAddF func(context context.Context, peerURLs []string) (*clientv3.MemberAddResponse, error)
memberRemoveF func(context context.Context, id uint64) (*clientv3.MemberRemoveResponse, error)
}
func (f *fakeClient) MemberList(context context.Context) (*clientv3.MemberListResponse, error) {
return f.memberListF(context)
}
func (f *fakeClient) MemberAdd(context context.Context, peerURLs []string) (*clientv3.MemberAddResponse, error) {
return f.memberAddF(context, peerURLs)
}
func (f *fakeClient) MemberRemove(context context.Context, id uint64) (*clientv3.MemberRemoveResponse, error) {
return f.memberRemoveF(context, id)
}
func (f *fakeClient) Close() error {
return nil
}