Get code coverage working

This commit is contained in:
Arthur Barr
2017-11-08 16:46:14 +00:00
parent 7c91187ce3
commit 4874483f9c
5 changed files with 58 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
You need to ensure you have the following tools installed:
* [Docker](https://www.docker.com/)
* [Go](https://golang.org/)
* [Go](https://golang.org/) - only needed for running the tests
* [Glide](https://glide.sh/)
* [dep](https://github.com/golang/dep) (official Go dependency management tool)
* make
@@ -21,10 +21,27 @@ There are three main sets of tests:
### Running the tests
The unit and Docker tests can be run locally. For example:
```bash
```
make test-devserver
```
or:
```
make test-advancedserver
```
### Running the tests with code coverage
You can produce code coverage results from the Docker tests by running the following:
```
make build-advancedserver-cover
make test-advancedserver-cover
```
In order to generate code coverage metrics from the Docker tests, the build step creates a new Docker image with an instrumented version of the code. Each test is then run individually, producing a coverage report each under `test/docker/coverage/`. These individual reports are then combined. The combined report is written to the `coverage` directory.
### Running the Kubernetes tests
For the Kubernetes tests, you need to have built the Docker image, and pushed it to the registry used by your Kubernetes cluster. Most of the configuration used by the tests is picked up from your `kubectl` configuration, but you will typically need to specify the image details. For example: