This commit is contained in:
Simon Tokumine
2012-07-09 15:57:10 +02:00
3 changed files with 18 additions and 6 deletions
+13 -6
View File
@@ -4,6 +4,11 @@
#
# NOTE: assumes existance of a "template_postgis"
# NOTE2: use PG* environment variables to control who and where
#
# NOTE3: a side effect of the db preparation is the persistent creation
# of two database roles which will be valid for the whole cluster
# TODO: fix that
#
die() {
msg=$1
@@ -11,15 +16,17 @@ die() {
exit 1
}
TEST_DB="cartodb_test_user_1_db"
echo "preparing redis..."
echo "HSET rails:users:vizzuality id 1" | redis-cli -n 5
echo "HSET rails:users:vizzuality database_name cartodb_test_user_1_db" | redis-cli -n 5
echo 'HSET rails:cartodb_test_user_1_db:my_table infowindow "this, that, the other"' | redis-cli -n 0
echo "HSET rails:users:vizzuality database_name '${TEST_DB}'" | redis-cli -n 5
echo 'HSET rails:${TEST_DB}:my_table infowindow "this, that, the other"' | redis-cli -n 0
echo "preparing postgres..."
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
dropdb "${TEST_DB}"
createdb -Ttemplate_postgis -EUTF8 "${TEST_DB}" || die "Could not create test database"
psql "${TEST_DB}" < ./sql/windshaft.test.sql
psql "${TEST_DB}" < ./sql/gadm4.sql
echo "Finished preparing data. Run tests with expresso."
+3
View File
@@ -96,6 +96,9 @@ ALTER TABLE ONLY gadm4
ADD CONSTRAINT bdll25_provincias_4326_2_pkey PRIMARY KEY (cartodb_id);
CREATE INDEX bdll25_provincias_4326_2_the_geom_webmercator_idx ON gadm4 USING gist (the_geom_webmercator);
-- development_cartodb_user_3 role
CREATE USER development_cartodb_user_3;
GRANT ALL ON TABLE gadm4 TO development_cartodb_user_3;
GRANT SELECT ON TABLE gadm4 TO tileuser;
+2
View File
@@ -15,6 +15,8 @@ SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
-- tileuser role
CREATE USER tileuser;
-- first table
CREATE TABLE test_table (