forked from p53841790/wheat-cache
feat(dao-external): add external mock
This commit is contained in:
parent
0c8a17b21d
commit
a5ef559e14
|
@ -14,4 +14,6 @@ var (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
GateWayCtrl *gomock.Controller
|
GateWayCtrl *gomock.Controller
|
||||||
|
mockGatewayClient proto.CommServerClient
|
||||||
|
oneMockGatewayClient sync.Once
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,7 +18,12 @@ func NewGatewayClient() (proto.CommServerClient, error) {
|
||||||
if GateWayCtrl == nil {
|
if GateWayCtrl == nil {
|
||||||
return nil, errorx.New("mock ctrl not init")
|
return nil, errorx.New("mock ctrl not init")
|
||||||
}
|
}
|
||||||
return mockClient.NewMockCommServerClient(GateWayCtrl), nil
|
|
||||||
|
oneMockGatewayClient.Do(func() {
|
||||||
|
mockGatewayClient = mockClient.NewMockCommServerClient(GateWayCtrl)
|
||||||
|
})
|
||||||
|
|
||||||
|
return mockGatewayClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
oneGatewayClient.Do(func() {
|
oneGatewayClient.Do(func() {
|
||||||
|
|
Loading…
Reference in New Issue