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:
Aaron Godin 2024-08-26 08:32:42 -05:00 committed by GitHub
parent 605bc811d2
commit 7623a844ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -239,6 +239,14 @@ test-go-unit: ## Run unit tests for backend with flags.
printf '$(GO_TEST_FILES)' | xargs \
$(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
test-go-integration: ## Run integration tests for backend with flags.
@echo "test backend integration tests"
@ -431,6 +439,12 @@ go-race-is-enabled:
enable-go-race:
@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
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)