Skip to content

Commit

Permalink
feat: simplify mock generation with .mockery.yaml configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
MeenuyD committed Jun 4, 2024
1 parent 9cf56d1 commit e1eefa0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
40 changes: 40 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
with-expecter: True
boilerplate-file: mocks/boilerplate.txt
packages:
github.com/opiproject/godpu/grpc:
interfaces:
Connector:
config:
dir: grpc
github.com/opiproject/godpu/inventory:
interfaces:
InvClient:
config:
dir: inventory
github.com/opiproject/godpu/network:
interfaces:
EvpnClient:
config:
dir: network
github.com/opiproject/godpu/ipsec:
interfaces:
IPsecClient:
config:
SrcPkg: github.com/opiproject/opi-api/security/v1/gen/go
github.com/opiproject/godpu/mocks:
interfaces:
InventorySvcClient:
config:
SrcPkg: github.com/opiproject/opi-api/common/v1/gen/go
SviServiceClient:
config:
SrcPkg: github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
VrfServiceClient:
config:
SrcPkg: github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
BridgePortServiceClient:
config:
SrcPkg: github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
LogicalBridgeServiceClient:
config:
SrcPkg: github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
20 changes: 1 addition & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,4 @@ go-fmt:
mock-generate:
@echo " > Starting mock code generation..."
# Generate mocks for exported interfaces
mockery --config=mocks/.mockery.yaml --name=Connector --dir=grpc
mockery --config=mocks/.mockery.yaml --name=InvClient --dir=inventory
mockery --config=mocks/.mockery.yaml --name=EvpnClient --dir=network

# Generate mocks for imported protobuf clients too
mockery --config=mocks/.mockery.yaml --name=IPsecServiceClient --srcpkg=github.com/opiproject/opi-api/security/v1/gen/go
mockery --config=mocks/.mockery.yaml --name=InventorySvcClient --srcpkg=github.com/opiproject/opi-api/inventory/v1/gen/go
mockery --config=mocks/.mockery.yaml --name=SviServiceClient --srcpkg=github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=VrfServiceClient --srcpkg=github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=BridgePortServiceClient --srcpkg=github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=LogicalBridgeServiceClient --srcpkg=github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=MiddleendEncryptionServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=MiddleendQosVolumeServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=NvmeRemoteControllerServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=NullVolumeServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=AioVolumeServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=FrontendNvmeServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=FrontendVirtioBlkServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml --name=FrontendVirtioScsiServiceClient --srcpkg=github.com/opiproject/opi-api/storage/v1alpha1/gen/go
mockery --config=mocks/.mockery.yaml

0 comments on commit e1eefa0

Please sign in to comment.