Skip to content

Commit

Permalink
Skip Mock packages while running tests
Browse files Browse the repository at this point in the history
- generate list of packages to test
- run test only on those packages
- remove -coverpkg flag

Signed-off-by: adrianc <adrianc@nvidia.com>
  • Loading branch information
adrianchiris committed May 21, 2023
1 parent 3ff5af7 commit 8f6cbf4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ GO_BUILD_OPTS ?= CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH)
GO_LDFLAGS = $(VERSION_LDFLAGS)


PKGS = $(or $(PKG),$(shell cd $(PROJECT_DIR) && go list ./... | grep -v "^nvidia-k8s-ipam/vendor/" | grep -v ".*/mocks"))

.PHONY: all
all: build

Expand Down Expand Up @@ -69,7 +71,7 @@ LCOV_PATH = $(PROJECT_DIR)/lcov.info

.PHONY: unit-test
unit-test: envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile=$(COVER_PROFILE)
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -covermode=$(COVERAGE_MODE) -coverprofile=$(COVER_PROFILE) $(PKGS)

.PHONY: test
test: lint unit-test
Expand Down

0 comments on commit 8f6cbf4

Please sign in to comment.