Skip to content

Commit

Permalink
Merge pull request #1932 from torredil/codecov
Browse files Browse the repository at this point in the history
Add code coverage report
  • Loading branch information
k8s-ci-robot authored Feb 15, 2024
2 parents 289df4e + b662ab7 commit 67f3920
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ bin
# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
# Output of the go coverage tool
*.out
coverage.html

# Vagrant
.vagrant
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ clean:
test:
go test -v -race ./cmd/... ./pkg/...

.PHONY: test/coverage
test/coverage:
go test -coverprofile=cover.out ./cmd/... ./pkg/...
grep -v "mock" cover.out > filtered_cover.out
go tool cover -html=filtered_cover.out -o coverage.html
rm cover.out filtered_cover.out

.PHONY: test-sanity
test-sanity:
go test -v -race ./tests/sanity/...
Expand Down
4 changes: 4 additions & 0 deletions docs/makefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ Build and push a multi-arch image of the driver based on the OSes in `ALL_OS`, a

Run all unit tests with race condition checking enabled.

### `make test/coverage`

Outputs a filtered version of the each package's unit test coverage profiling via go's coverage tool to a local `coverage.html` file.

### `make test-sanity`

Run the official [CSI sanity tests](https://github.com/kubernetes-csi/csi-test). _Warning: Currently, 3 of the tests are known to fail incorrectly._
Expand Down

0 comments on commit 67f3920

Please sign in to comment.