From fff832fd004262860af11cfe56529efc90208458 Mon Sep 17 00:00:00 2001 From: Bryan Hockey Date: Mon, 20 Nov 2023 17:09:16 -0500 Subject: [PATCH] System tests use new lauth_demo db --- db/setup.sh | 15 +++++++++++---- docker-compose.yml | 6 +++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/db/setup.sh b/db/setup.sh index 2de01075..2667a4e8 100755 --- a/db/setup.sh +++ b/db/setup.sh @@ -2,7 +2,7 @@ directory=$(dirname "$0") -while getopts u:p:h:P: option +while getopts u:p:h:P:a option do case "${option}" in @@ -10,6 +10,7 @@ do p)p=${OPTARG};; h)h=${OPTARG};; P)P=${OPTARG};; + a)all="true";; esac done @@ -28,11 +29,17 @@ echo " password : $password" echo " host : $host" echo " port : $port" echo " database : $database" +echo " add data : ${all:=false}" +echo "" + mariadb -u root --host=$host --port=$port -e "CREATE DATABASE ${database} DEFAULT CHARACTER SET utf8" mariadb -u root --host=$host --port=$port -e "GRANT ALL ON ${database}.* TO ${user}@'%' IDENTIFIED by '${password}'" mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/tables.sql" -# mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/root.sql" -# mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/keys.sql" -# mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/test-fixture.sql" + +if [[ $all == "true" ]]; then + mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/root.sql" + mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/keys.sql" + mariadb --user=$user --host=$host --port=$port --password=$password $database < "$directory/test-fixture.sql" +fi diff --git a/docker-compose.yml b/docker-compose.yml index 2aae1cf5..987a4d30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,8 @@ services: args: UID: ${UID:-1000} GID: ${GID:-1000} + environment: + - DATABASE_URL=mysql2://lauth:lauth@db.lauth.local:3306/lauth_demo hostname: app.lauth.local networks: default: @@ -156,7 +158,9 @@ services: command: - /bin/bash - "-c" - - "/sql/setup.sh -u lauth -p lauth -h db.lauth.local lauth_development && /sql/setup.sh -u lauth -p lauth -h db.lauth.local lauth_test" + - "/sql/setup.sh -u lauth -p lauth -h db.lauth.local lauth_development && \ + /sql/setup.sh -u lauth -p lauth -h db.lauth.local lauth_test && \ + /sql/setup.sh -u lauth -p lauth -h db.lauth.local -a lauth_demo" volumes: mariadb_data: