mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add test-go-unit-pretty (#91645)
Add make task for executing go test over a set of files and piping to tparse
This commit is contained in:
parent
605bc811d2
commit
7623a844ba
14
Makefile
14
Makefile
@ -239,6 +239,14 @@ test-go-unit: ## Run unit tests for backend with flags.
|
|||||||
printf '$(GO_TEST_FILES)' | xargs \
|
printf '$(GO_TEST_FILES)' | xargs \
|
||||||
$(GO) test $(GO_RACE_FLAG) -short -covermode=atomic -timeout=30m
|
$(GO) test $(GO_RACE_FLAG) -short -covermode=atomic -timeout=30m
|
||||||
|
|
||||||
|
.PHONY: test-go-unit-pretty
|
||||||
|
test-go-unit-pretty: check-tparse
|
||||||
|
@if [ -z "$(FILES)" ]; then \
|
||||||
|
echo "Notice: FILES variable is not set. Try \"make test-go-unit-pretty FILES=./pkg/services/mysvc\""; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
$(GO) test $(GO_RACE_FLAG) -timeout=10s $(FILES) -json | tparse -all
|
||||||
|
|
||||||
.PHONY: test-go-integration
|
.PHONY: test-go-integration
|
||||||
test-go-integration: ## Run integration tests for backend with flags.
|
test-go-integration: ## Run integration tests for backend with flags.
|
||||||
@echo "test backend integration tests"
|
@echo "test backend integration tests"
|
||||||
@ -431,6 +439,12 @@ go-race-is-enabled:
|
|||||||
enable-go-race:
|
enable-go-race:
|
||||||
@touch .go-race-enabled-locally
|
@touch .go-race-enabled-locally
|
||||||
|
|
||||||
|
check-tparse:
|
||||||
|
@command -v tparse >/dev/null 2>&1 || { \
|
||||||
|
echo >&2 "Error: tparse is not installed. Refer to https://github.com/mfridman/tparse"; \
|
||||||
|
exit 1; \
|
||||||
|
}
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help: ## Display this help.
|
help: ## Display this help.
|
||||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||||
|
Loading…
Reference in New Issue
Block a user