Refactor testing into docker file

This means a decent scale refactor but ends with our testing being much simpler

	Key changes:
		* single Dockerfile for all services
		* tests moved into docker up so don't need to be run locally
		* configurations moved to environment
This commit is contained in:
Marc Di Luzio 2020-06-11 18:16:11 +01:00
parent 99da6c5d67
commit 14424c16ca
13 changed files with 171 additions and 107 deletions

View file

@ -12,22 +12,9 @@ gen:
protoc --proto_path pkg/accounts --go_out=plugins=grpc:pkg/accounts/ --go_opt=paths=source_relative pkg/accounts/accounts.proto
test:
go mod download
go build ./...
docker-compose up --build --exit-code-from=rove-tests --abort-on-container-exit
# Run the server and shut it down again to ensure our docker-compose works
ROVE_ARGS="--quit 1" docker-compose up --build --exit-code-from=rove-server --abort-on-container-exit
# TODO: Collect and convert the coverage data to html
# go tool cover -html=/tmp/c.out -o /tmp/coverage.html
# Run the server and shut it down again to ensure our docker-compose works
docker-compose up -d
# Run tests with coverage and integration tags
go test -v ./... --tags=integration -cover -coverprofile=/tmp/c.out -count 1
#
docker-compose down
# Convert the coverage data to html
go tool cover -html=/tmp/c.out -o /tmp/coverage.html
.PHONY: install test
.PHONY: install test