2011-10-20 22:44:37 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# this script prepare database and redis instance to run accpetance test
|
2012-07-04 01:31:30 +08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
}
|
2011-10-20 22:44:37 +08:00
|
|
|
|
|
|
|
echo "preparing redis..."
|
|
|
|
echo "HSET rails:users:vizzuality id 1" | redis-cli -n 5
|
2011-10-21 00:52:11 +08:00
|
|
|
echo "HSET rails:users:vizzuality database_name cartodb_test_user_1_db" | redis-cli -n 5
|
2011-12-13 02:02:10 +08:00
|
|
|
echo 'HSET rails:cartodb_test_user_1_db:my_table infowindow "this, that, the other"' | redis-cli -n 0
|
2011-10-20 22:44:37 +08:00
|
|
|
|
|
|
|
echo "preparing postgres..."
|
2012-07-04 01:31:30 +08:00
|
|
|
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
|
2011-10-20 22:44:37 +08:00
|
|
|
|
2011-12-13 02:02:10 +08:00
|
|
|
echo "Finished preparing data. Run tests with expresso."
|