diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9167495ccd..5490871abc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -144,6 +144,15 @@ $ make test-database-up $ make test ``` +By default the container name is `boundary-sql-tests`. +This can be changed in the same way as the port: + +``` +$ export TEST_CONTAINER_NAME="custom-name" +$ make test-database-up +$ docker logs custom-name +``` + The default docker image is built using the `postgres:11` base image. The image can be changed using a make option to test against other versions: diff --git a/testing/dbtest/docker/Makefile b/testing/dbtest/docker/Makefile index 93734b9f0a..0d4ff3d995 100644 --- a/testing/dbtest/docker/Makefile +++ b/testing/dbtest/docker/Makefile @@ -8,6 +8,7 @@ IMAGE_NAME=postgres IMAGE_TAG ?= $(REGISTRY_NAME)/$(IMAGE_NAME):11-alpine PG_OPTS ?= TEST_DB_PORT ?= 5432 +TEST_CONTAINER_NAME ?= boundary-sql-tests # Generate targets from dockerfiles dockerfiles = $(wildcard Dockerfile.*) @@ -29,7 +30,7 @@ database-up: @echo "Additional postgres configuration: $(PG_OPTS)" @docker run \ $(DOCKER_ARGS) \ - --name boundary-sql-tests \ + --name $(TEST_CONTAINER_NAME) \ -p $(TEST_DB_PORT):5432 \ -e POSTGRES_PASSWORD=boundary \ -e POSTGRES_USER=boundary \ @@ -40,11 +41,12 @@ database-up: $(IMAGE_TAG) \ -c 'config_file=/etc/postgresql/postgresql.conf' \ $(PG_OPTS) 1> /dev/null + @echo "Container name: $(TEST_CONTAINER_NAME)" @echo "Test database available at: 127.0.0.1:$(TEST_DB_PORT)" @echo "For database logs run:" - @echo " docker logs boundary-sql-tests" + @echo " docker logs $(TEST_CONTAINER_NAME)" clean: - docker stop boundary-sql-tests || true - docker rm -v boundary-sql-tests || true + docker stop $(TEST_CONTAINER_NAME) || true + docker rm -v $(TEST_CONTAINER_NAME) || true .PHONY: all docker-build database-up ${docker-builds} ${docker-publishes} clean