diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 00000000..7ada9b04 --- /dev/null +++ b/.mockery.yaml @@ -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: diff --git a/Makefile b/Makefile index 5723eb6d..5e006741 100644 --- a/Makefile +++ b/Makefile @@ -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