Skip to content

Commit

Permalink
Coverage calculation is slow, make a separate test-cover command
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Nov 3, 2017
1 parent e0ded23 commit 449c956
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.jsonnet
Expand Up @@ -78,7 +78,7 @@ local jobs = {

'unit-tests': unittest_stage {
coverage: @"/\d\d\.\d.$/",
script: ["make vendor", "make test", "make cover"],
script: ["make vendor", "make test-cover"],
},

// End2End tests
Expand Down
3 changes: 1 addition & 2 deletions .gitlab-ci.yml
Expand Up @@ -187,8 +187,7 @@ unit-tests:
image: quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}
script:
- make vendor
- make test
- make cover
- make test-cover
stage: tests
tags:
- kubernetes
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Expand Up @@ -8,17 +8,23 @@ IMAGE_TAG ?= "dev"

.PHONY: test run clean vendor vendor-update coverage

COVERUTIL := $(GOPATH)/bin/gocoverutil

$(COVERUTIL):
go get -u github.com/AlekSi/gocoverutil

all: test build

test:
go vet ./pkg/...
go test -v -race ./pkg/...
go test -v ./Documentation/...
go test -v -race ./pkg/...

COVERUTIL := $(GOPATH)/bin/gocoverutil

$(COVERUTIL):
go get -u github.com/AlekSi/gocoverutil
test-cover: $(COVERUTIL)
go vet ./pkg/...
go test -v ./Documentation/...
$(COVERUTIL) -coverprofile=cover.out test -v -race -covermode=count ./pkg/...
go tool cover -func=cover.out

cover: $(COVERUTIL)
$(COVERUTIL) -coverprofile=cover.out test -covermode=count ./pkg/...
Expand Down

0 comments on commit 449c956

Please sign in to comment.