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

add mock-generate entry in makefile using mockery #314

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ GOLANGCI_LINT_VERSION = v1.52.2
$(GOLANGCI_LINT): | $(BINDIR) ; $(info Installing golangci-lint...)
$Q GOBIN=$(BINDIR) $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

# Tools
MOCKERY = $(BINDIR)/mockery
MOCKERY_VERSION = v2.50.2
$(MOCKERY): | $(BINDIR) ; $(info Installing mockery...)
$Q GOBIN=$(BINDIR) $(GO) install github.com/vektra/mockery/v2@$(MOCKERY_VERSION)

# Tests
TEST_TARGETS := test-default test-verbose test-race
.PHONY: $(TEST_TARGETS) test
Expand All @@ -76,6 +82,12 @@ test-coverage: | $(COVERAGE_DIR) ; $(info Running coverage tests...) @ ## Run c
lint: $(GOLANGCI_LINT) ; $(info Running golangci-lint linter...) @ ## Run golangci-lint linter
$Q $(GOLANGCI_LINT) run

.PHONY: mock-generate
mock-generate: $(MOCKERY) ; $(info Running mockery...) @ ## Run golangci-lint linter
$Q $(MOCKERY) --recursive=true --name=NetlinkManager --output=./pkg/utils/mocks/ --filename=netlink_manager_mock.go --exported --dir pkg/utils
$Q $(MOCKERY) --recursive=true --name=pciUtils --output=./pkg/sriov/mocks/ --filename=pci_utils_mock.go --exported --dir pkg/sriov


.PHONY: fmt
fmt: ; $(info Running go fmt...) @ ## Run go fmt on all source files
@ $(GO) fmt ./...
Expand Down
22 changes: 21 additions & 1 deletion pkg/sriov/mocks/pci_utils_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 53 additions & 1 deletion pkg/utils/mocks/netlink_manager_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading