mirror of https://github.com/helm/helm.git
Adapt test-coverage command to be able to run for a certain package
Signed-off-by: Stephanie Hohenberg <stephanie.hohenberg@gmail.com>
This commit is contained in:
parent
fc22b6df31
commit
1904ef6ad8
9
Makefile
9
Makefile
|
@ -118,11 +118,12 @@ test-unit:
|
|||
go test $(GOFLAGS) -run ^TestHelmCreateChart_CheckDeprecatedWarnings$$ ./internal/chart/v3/lint/ $(TESTFLAGS) -ldflags '$(LDFLAGS)'
|
||||
|
||||
|
||||
# To run the coverage for a specific package use: make test-coverage PKG=./pkg/action
|
||||
.PHONY: test-coverage
|
||||
test-coverage:
|
||||
@echo
|
||||
@echo "==> Running unit tests with coverage <=="
|
||||
@ ./scripts/coverage.sh
|
||||
@echo "==> Running unit tests with coverage: $(PKG) <=="
|
||||
@ ./scripts/coverage.sh $(PKG)
|
||||
|
||||
.PHONY: test-style
|
||||
test-style:
|
||||
|
@ -148,10 +149,6 @@ test-acceptance: build build-cross
|
|||
test-acceptance-completion: ACCEPTANCE_RUN_TESTS = shells.robot
|
||||
test-acceptance-completion: test-acceptance
|
||||
|
||||
.PHONY: coverage
|
||||
coverage:
|
||||
@scripts/coverage.sh
|
||||
|
||||
.PHONY: format
|
||||
format: $(GOIMPORTS)
|
||||
go list -f '{{.Dir}}' ./... | xargs $(GOIMPORTS) -w -local helm.sh/helm
|
||||
|
|
|
@ -19,9 +19,10 @@ set -euo pipefail
|
|||
covermode=${COVERMODE:-atomic}
|
||||
coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX)
|
||||
profile="${coverdir}/cover.out"
|
||||
target="${1:-./...}" # by default the whole repository is tested
|
||||
|
||||
generate_cover_data() {
|
||||
for d in $(go list ./...) ; do
|
||||
for d in $(go list "$target"); do
|
||||
(
|
||||
local output="${coverdir}/${d//\//-}.cover"
|
||||
go test -coverprofile="${output}" -covermode="$covermode" "$d"
|
||||
|
|
Loading…
Reference in New Issue