Improve SQL test script

This commit is contained in:
2020-05-11 02:29:02 +02:00
parent ecae3848ea
commit 0253480b10
7 changed files with 35 additions and 8 deletions

33
src/test/sql/test.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
PS3='Please enter your choice: '
options=("RESET DB" "All" "article" "citizen" "comment" "constitution" "follow" "opinion" "user" "vote" "workgroup" "Quit")
select opt in "${options[@]}"
do
case $opt in
"RESET DB")
cat \
../../main/resources/sql/migrations/*.down.sql \
../../main/resources/sql/migrations/*.up.sql > ./allSQL.sql
docker exec -i postgresql_dc-project psql test test -q -b -v "ON_ERROR_STOP=1" < ./allSQL.sql
rm ./allSQL.sql
break;;
"All")
cat ../../main/resources/sql/functions/*/*.sql \
./fixtures/*.sql \
./*.sql > ./allSQL.sql
docker exec -i postgresql_dc-project psql test test -q -b -v "ON_ERROR_STOP=1" < ./allSQL.sql
rm ./allSQL.sql
break;;
"Quit")
break;;
*) echo "Start tests $opt"
cat ../../main/resources/sql/functions/*/*.sql \
./fixtures/*.sql \
./"$opt".sql > ./allSQL.sql
docker exec -i postgresql_dc-project psql test test -q -b -v "ON_ERROR_STOP=1" < ./allSQL.sql
rm ./allSQL.sql
break;;
esac
done

View File

@@ -1,6 +0,0 @@
#bin/bash
echo "Start tests"
cat ../main/resources/sql/functions/*/*.sql ../main/resources/sql/migrations/*.sql ./sql/fixtures/*.sql ./sql/*.sql > ./allSQL.sql
docker exec -i postgresql_dc-project psql test test -q -b -v "ON_ERROR_STOP=1" < ./allSQL.sql
rm ./allSQL.sql
#sleep 20