feat(dao-external): add external mock

This commit is contained in:
bandl 2021-11-21 23:10:14 +08:00
parent 0c8a17b21d
commit a5ef559e14
2 changed files with 9 additions and 2 deletions

View File

@ -13,5 +13,7 @@ var (
)
var (
GateWayCtrl *gomock.Controller
GateWayCtrl *gomock.Controller
mockGatewayClient proto.CommServerClient
oneMockGatewayClient sync.Once
)

View File

@ -18,7 +18,12 @@ func NewGatewayClient() (proto.CommServerClient, error) {
if GateWayCtrl == nil {
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() {