From 2143940a4ac4c0c609404f4e5e83c1a2bfff1685 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Mon, 13 Sep 2021 17:13:57 -0400 Subject: [PATCH] refactor(dbtest): Support new paths for migration files This updates the docker image used for tests to support the new location for sql migration files and the concept of editions. It continues to process the old paths for now if the new directory does not exist, so that the same image can be used during the transition. --- testing/dbtest/docker/Makefile | 2 +- testing/dbtest/docker/init-db.sh | 96 ++++++++++++++++++++++++-------- 2 files changed, 73 insertions(+), 25 deletions(-) diff --git a/testing/dbtest/docker/Makefile b/testing/dbtest/docker/Makefile index ea9db518de..93734b9f0a 100644 --- a/testing/dbtest/docker/Makefile +++ b/testing/dbtest/docker/Makefile @@ -36,7 +36,7 @@ database-up: -e POSTGRES_DB=boundary \ -e PGDATA=/pgdata \ --mount type=tmpfs,destination=/pgdata \ - -v "$(CWD)/../../../internal/db/schema/migrations/postgres":/migrations \ + -v "$(CWD)/../../../internal/db/schema/migrations":/migrations \ $(IMAGE_TAG) \ -c 'config_file=/etc/postgresql/postgresql.conf' \ $(PG_OPTS) 1> /dev/null diff --git a/testing/dbtest/docker/init-db.sh b/testing/dbtest/docker/init-db.sh index ae18f8edce..a2512f5727 100755 --- a/testing/dbtest/docker/init-db.sh +++ b/testing/dbtest/docker/init-db.sh @@ -2,43 +2,91 @@ set -e shopt -s globstar +# Create database to use as template psql -v "ON_ERROR_STOP=1" --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -q <