Skip to content

Commit

Permalink
Use mockery for generating mocks
Browse files Browse the repository at this point in the history
The codebase is to use testify/mock instead of gomock
  • Loading branch information
joelrebel committed Apr 26, 2024
1 parent d40fd31 commit 49ac14e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
testonly: False
with-expecter: True
packages:
github.com/metal-toolbox/flasher/internal/runner:
config:
dir: internal/runner
fileName: "mock_{{.InterfaceName | firstLower}}.go"
inpackage: true
interfaces:
TaskHandler:
ActionHandler:
github.com/metal-toolbox/flasher/internal/device:
config:
dir: internal/device
fileName: "mock_{{.InterfaceName | firstLower}}.go"
inpackage: true
interfaces:
Queryor:
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ REPO := "https://github.com/metal-toolbox/flasher.git"
lint: gen-mock
golangci-lint run --config .golangci.yml

## generate mocks
## Generate mocks
gen-mock:
go install go.uber.org/mock/mockgen@v0.4.0
mockgen -source internal/runner/runner.go -destination=internal/runner/runner_mock.go -package=runner
go install github.com/vektra/mockery/v2@v2.42.1
mockery
go mod tidy

## Go test
Expand Down

0 comments on commit 49ac14e

Please sign in to comment.