Merge pull request #504 from aaron-prindle/code-coverage
Working on adding test coverage monitoringpull/505/head
commit
f80ecf9263
12
.travis.yml
12
.travis.yml
|
@ -1,12 +1,10 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.6.3
|
||||
go_import_path: k8s.io/minikube
|
||||
|
||||
# We shouldn't need to install anything because we use vendoring.
|
||||
install:
|
||||
- echo "Don't run anything."
|
||||
|
||||
# Run unit tests and linters.
|
||||
script: make test
|
||||
- echo "Don't run anything."
|
||||
script:
|
||||
- make test
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Minikube
|
||||
|
||||
[![Build Status](https://travis-ci.org/kubernetes/minikube.svg?branch=master)](https://travis-ci.org/kubernetes/minikube)
|
||||
[![codecov](https://codecov.io/gh/aaron-prindle/minikube/branch/master/graph/badge.svg)](https://codecov.io/gh/aaron-prindle/minikube)
|
||||
|
||||
## What is Minikube?
|
||||
|
||||
|
|
17
test.sh
17
test.sh
|
@ -25,11 +25,22 @@ else
|
|||
PYTHON="docker run --rm -it -v $(pwd):/minikube -w /minikube python python"
|
||||
fi
|
||||
|
||||
# Run "go test" on packages that have test files.
|
||||
|
||||
COV_FILE=coverage.txt
|
||||
COV_TMP_FILE=coverage_tmp.txt
|
||||
|
||||
# Run "go test" on packages that have test files. Also create coverage profile
|
||||
echo "Running go tests..."
|
||||
cd ${GOPATH}/src/${REPO_PATH}
|
||||
TESTS=$(go list -f '{{ if .TestGoFiles }} {{.ImportPath}} {{end}}' ./...)
|
||||
go test -v ${TESTS}
|
||||
rm -f out/$COV_FILE
|
||||
echo "mode: count" > out/$COV_FILE
|
||||
for pkg in $(go list -f '{{ if .TestGoFiles }} {{.ImportPath}} {{end}}' ./...); do
|
||||
go test -v $pkg -covermode=count -coverprofile=out/$COV_TMP_FILE
|
||||
# tail -n +2 skips the first line of the file
|
||||
# for coverprofile the first line is the `mode: count` line which we only want once in our file
|
||||
tail -n +2 out/$COV_TMP_FILE >> out/$COV_FILE || (echo "Unable to append coverage for $pkg" && exit 1)
|
||||
done
|
||||
rm out/$COV_TMP_FILE
|
||||
|
||||
# Ignore these paths in the following tests.
|
||||
ignore="vendor\|\_gopath\|assets.go"
|
||||
|
|
Loading…
Reference in New Issue