changeset 246:299568ad3c37

Use database setup script for tests and Dockerfile
author Tom Gottfried <tom@intevation.de>
date Thu, 26 Jul 2018 19:22:07 +0200
parents 9f6d29f8ac2b
children 946baea3d280
files schema/Dockerfile schema/run_tests.sh
diffstat 2 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/schema/Dockerfile	Thu Jul 26 18:56:01 2018 +0200
+++ b/schema/Dockerfile	Thu Jul 26 19:22:07 2018 +0200
@@ -29,11 +29,7 @@
 COPY *.sql *.sh ./
 COPY demo-data ./demo-data/
 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
-    psql -f roles.sql && \
-    createdb gemma && \
-    psql -f gemma.sql -f auth.sql -f manage_users.sql -d gemma && \
-    psql -f demo-data/responsibility_areas.sql -d gemma && \
-    psql -f demo-data/roles.sql -f demo-data/users.sql -d gemma && \
+    ./install-db.sh --demo && \
     $PGBIN/pg_ctl stop -m smart
 
 # Set the default command to run when starting the container
--- a/schema/run_tests.sh	Thu Jul 26 18:56:01 2018 +0200
+++ b/schema/run_tests.sh	Thu Jul 26 19:22:07 2018 +0200
@@ -1,14 +1,10 @@
 #!/bin/sh -e
 
 dropdb --if-exists gemma_test
-createdb gemma_test
+
+./install-db.sh -d gemma_test
 psql -qv ON_ERROR_STOP= -c 'CREATE EXTENSION pgtap' -d gemma_test
 
-psql -qv ON_ERROR_STOP= -d gemma_test \
-    -f gemma.sql \
-    -f auth.sql \
-    -f manage_users.sql
-
 # Collect test roles to be dropped
 # Concatenate with dummy role to prevent syntax error if there is no test role
 TEST_ROLES=$(psql -qtc \