Skip to content

use only mockery.yaml #282

@glimchb

Description

@glimchb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions