Improve SQL test script
This commit is contained in:
33
src/test/sql/test.sh
Normal file
33
src/test/sql/test.sh
Normal 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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user