Do not force location and permissions on db, properly use exit code

This commit is contained in:
Sandro Santilli 2012-07-03 19:31:30 +02:00
parent f95e15e6fe
commit 2e8398b11c

View File

@ -1,7 +1,15 @@
#!/bin/sh
# this script prepare database and redis instance to run accpetance test
# Note: requires a postgis template called template_postgis
#
# NOTE: assumes existance of a "template_postgis"
# NOTE2: use PG* environment variables to control who and where
die() {
msg=$1
echo "${msg}" >&2
exit 1
}
echo "preparing redis..."
echo "HSET rails:users:vizzuality id 1" | redis-cli -n 5
@ -9,9 +17,9 @@ echo "HSET rails:users:vizzuality database_name cartodb_test_user_1_db" | redis-
echo 'HSET rails:cartodb_test_user_1_db:my_table infowindow "this, that, the other"' | redis-cli -n 0
echo "preparing postgres..."
dropdb -Upostgres -hlocalhost cartodb_test_user_1_db
createdb -Upostgres -hlocalhost -Ttemplate_postgis -Opostgres -EUTF8 cartodb_test_user_1_db
psql -Upostgres -hlocalhost cartodb_test_user_1_db < ./sql/windshaft.test.sql
psql -Upostgres -hlocalhost cartodb_test_user_1_db < ./sql/gadm4.sql
dropdb cartodb_test_user_1_db
createdb -Ttemplate_postgis -EUTF8 cartodb_test_user_1_db || die "Could not create test database"
psql cartodb_test_user_1_db < ./sql/windshaft.test.sql
psql cartodb_test_user_1_db < ./sql/gadm4.sql
echo "Finished preparing data. Run tests with expresso."