Skip to content

Commit

Permalink
feat: add mock generation for DA interface using mockery (#110)
Browse files Browse the repository at this point in the history
This commit introduces mock generation for the DA interface, including a new `mock-gen` Makefile target. A `.mockery.yaml` configuration file is added and dependencies updated to support the mock generation.
  • Loading branch information
tzdybal authored Sep 27, 2024
1 parent fe0387a commit 0672e20
Show file tree
Hide file tree
Showing 5 changed files with 536 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages:
github.com/rollkit/go-da:
config:
dir: mocks
outpkg: mocks
filename: "{{.InterfaceName}}.go"
interfaces:
DA:
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,11 @@ proto-lint: check-proto-deps
@echo "--> Linting Protobuf files"
@go run github.com/bufbuild/buf/cmd/buf@latest lint --error-format=json
.PHONY: proto-lint

## mock-gen: Re-generates DA mock
mock-gen: mocks/DA.go
.PHONY: mock-gen

mocks/DA.go: da.go .mockery.yaml
@mockery

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require (
github.com/gorilla/websocket v1.4.2 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
go.opencensus.io v0.22.3 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down
Loading

0 comments on commit 0672e20

Please sign in to comment.