Skip to content

Commit

Permalink
limit test cover packages (#687)
Browse files Browse the repository at this point in the history
* limit test cover packages

* remove coverage.out
  • Loading branch information
xiaojingchen authored Jul 24, 2019
1 parent 62d7d26 commit 0f253d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ filenametags
*.coverprofile

coverage.txt
coverage.out

# retool. We could check this in like a vendor
# But it is just tools that can be installed with make setup
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PACKAGE_LIST := go list ./... | grep -vE "pkg/client" | grep -vE "zz_generated"
PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|github.com/pingcap/tidb-operator/||'
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
FAIL_ON_STDOUT := awk '{ print } END { if (NR > 0) { exit 1 } }'
TEST_COVER_PACKAGES:=go list ./pkg/... | grep -vE "pkg/client" | grep -vE "pkg/tkctl" | grep -vE "pkg/apis" | sed 's|github.com/pingcap/tidb-operator/|./|' | tr '\n' ','

default: build

Expand Down Expand Up @@ -79,7 +80,7 @@ fault-trigger:

test:
@echo "Run unit tests"
@$(GOTEST) ./pkg/... -coverprofile=coverage.txt -covermode=atomic && echo "\nUnit tests run successfully!"
@$(GOTEST) ./pkg/... -coverpkg=$$($(TEST_COVER_PACKAGES)) -coverprofile=coverage.txt -covermode=atomic && echo "\nUnit tests run successfully!"

check-all: lint check-static check-shadow check-gosec staticcheck errcheck

Expand Down

0 comments on commit 0f253d7

Please sign in to comment.