Skip to content

Commit

Permalink
Merge pull request #779 from cpanato/GH-692
Browse files Browse the repository at this point in the history
makefile: Add a make target to generate test coverage report
  • Loading branch information
k8s-ci-robot authored Aug 3, 2020
2 parents 3b2f7fd + ea8ae55 commit 5684af2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bin

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.*

# Ansible
*.retry
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,21 @@ help: ## Display this help
.PHONY: test
test: generate lint go-test ## Run generate lint and tests

go-test: export TEST_ASSET_KUBECTL = $(KUBECTL)
go-test: export TEST_ASSET_KUBE_APISERVER = $(KUBE_APISERVER)
go-test: export TEST_ASSET_ETCD = $(ETCD)
envs-test:
export TEST_ASSET_KUBECTL = $(KUBECTL)
export TEST_ASSET_KUBE_APISERVER = $(KUBE_APISERVER)
export TEST_ASSET_ETCD = $(ETCD)

.PHONY: go-test
go-test: $(KUBECTL) $(KUBE_APISERVER) $(ETCD) ## Run go tests
go-test: envs-test $(KUBECTL) $(KUBE_APISERVER) $(ETCD) ## Run go tests
echo $(TEST_ASSET_KUBECTL)
go test ./...

.PHONY: test-cover
test-cover: envs-test $(KUBECTL) $(KUBE_APISERVER) $(ETCD) ## Run tests with code coverage and code generate reports
go test -v -coverprofile=coverage.out ./...
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html

.PHONY: test-integration
test-integration: ## Run integration tests
Expand Down

0 comments on commit 5684af2

Please sign in to comment.