Skip to content

Commit

Permalink
makefile: Split the unit/integration tests coverage report generation (
Browse files Browse the repository at this point in the history
  • Loading branch information
art-tapin committed Jul 24, 2023
1 parent 88d6cc2 commit 9ae0ffb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ IMG ?= $(IMAGE_TAG_BASE):$(IMAGE_TAG)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.22

# Directories containing unit test packages
TEST_DIRS := pkg/common pkg/istio pkg/log pkg/reconcilers pkg/rlptools controllers

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -257,13 +260,17 @@ clean-cov: ## Remove coverage report
test: test-unit test-integration ## Run all tests

test-integration: clean-cov generate fmt vet envtest ## Run Integration tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) $(ARCH_PARAM) use $(ENVTEST_K8S_VERSION) -p path)" USE_EXISTING_CLUSTER=true go test ./... -coverprofile $(PROJECT_PATH)/cover.out -tags integration -ginkgo.v -ginkgo.progress -v -timeout 0
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) $(ARCH_PARAM) use $(ENVTEST_K8S_VERSION) -p path)" USE_EXISTING_CLUSTER=true go test ./... -coverprofile $(PROJECT_PATH)/coverage/integration/cover.out -tags integration -ginkgo.v -ginkgo.progress -v -timeout 0

ifdef TEST_NAME
test-unit: TEST_PATTERN := --run $(TEST_NAME)
endif
test-unit: clean-cov generate fmt vet ## Run Unit tests.
go test ./... -coverprofile $(PROJECT_PATH)/cover.out -tags unit -v -timeout 0 $(TEST_PATTERN)
@for dir in $(TEST_DIRS); do \
echo "Running tests in $$dir..."; \
mkdir -p coverage/unit/$$dir; \
go test ./$$dir -coverprofile $(PROJECT_PATH)/coverage/unit/$$dir/cover.out -tags unit -v -timeout 0 $(TEST_PATTERN); \
done

.PHONY: namespace
namespace: ## Creates a namespace where to deploy Kuadrant Operator
Expand Down

0 comments on commit 9ae0ffb

Please sign in to comment.