ci: Update Makefile with new targets for testing

This updates the test-ci target to startup the test database container
first, wait for it to be ready, and then start running the tests.

It also creates some new targets for local devs. Prior to running any
tests either via `make test` or `go test`, the database should be
started with:

    make test-database-up

It can take a few seconds for the database to fully initialize, the
status can be checked with:

    docker logs -f boundary-sql-tests

This database can be stopped and destroyed with:

    make test-database-down

In general it should only need to be restarted when new migrations are
added. But it might also be necessary to restart if some tests fail in
an unexpected way and fail to do cleanup steps.
This commit is contained in:
Timothy Messier committed 2021-09-09 13:42:01 -04:00
1 parent 75388f727a
commit ecdcf72e0e
5 files changed
+136 -11

No files matched your search

+9 -3
View File
@@ -157,14 +157,20 @@ website-install:
website-start:
@npm start --prefix website/
test-database-up:
make -C testing/dbtest/docker database-up
test-database-down:
make -C testing/dbtest/docker clean
test-ci: install-go
~/.go/bin/go test ./... -v $(TESTARGS) -timeout 120m
test-sql:
$(MAKE) -C internal/db/sqltest/ test
test:
~/.go/bin/go test ./... -timeout 30m
test:
go test ./... -timeout 30m
install-go:
./ci/goinstall.sh
@@ -207,7 +213,7 @@ docker-publish:
docker push $(IMAGE_TAG)
docker push hashicorp/boundary:latest
.PHONY: api cli tools gen migrations proto website ci-config ci-verify set-ui-version docker docker-build docker-build-dev docker-publish
.PHONY: api cli tools gen migrations proto website ci-config ci-verify set-ui-version docker docker-build docker-build-dev docker-publish test-database-up test-database-down
.NOTPARALLEL: