Skip to content

Commit

Permalink
System tests use new lauth_demo db
Browse files Browse the repository at this point in the history
  • Loading branch information
malakai97 committed Nov 20, 2023
1 parent 50e1e05 commit fff832f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 11 additions & 4 deletions db/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

directory=$(dirname "$0")

while getopts u:p:h:P: option
while getopts u:p:h:P:a option
do
case "${option}"
in
u)u=${OPTARG};;
p)p=${OPTARG};;
h)h=${OPTARG};;
P)P=${OPTARG};;
a)all="true";;
esac
done

Expand All @@ -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
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
args:
UID: ${UID:-1000}
GID: ${GID:-1000}
environment:
- DATABASE_URL=mysql2://lauth:[email protected]:3306/lauth_demo
hostname: app.lauth.local
networks:
default:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fff832f

Please sign in to comment.