forked from p93542168/wheat-cache
feat(dao-external): add external mock
This commit is contained in:
parent
0c8a17b21d
commit
a5ef559e14
|
@ -13,5 +13,7 @@ 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