Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use only mockery.yaml #282

Open
glimchb opened this issue Aug 29, 2023 · 0 comments
Open

use only mockery.yaml #282

glimchb opened this issue Aug 29, 2023 · 0 comments
Labels
good first issue Good for newcomers

Comments

@glimchb
Copy link
Member

glimchb commented Aug 29, 2023

see https://github.com/vektra/mockery/blob/master/.mockery.yaml

for example:

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

and then Makefile rule becomes just one liner

mock-generate:
	@echo "  >  Starting mock code generation..."
	# Generate mocks for exported interfaces
	mockery --config=mocks/.mockery.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant