Skip to content

Commit

Permalink
[#517] First try on a separate testing db
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Mar 1, 2013
1 parent 15c23b2 commit 6c6c955
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Expand Up @@ -9,21 +9,21 @@ install:
- "pip install -r pip-requirements.txt --use-mirrors"
- "pip install -r pip-requirements-test.txt --use-mirrors"
before_script:
- psql -c 'CREATE DATABASE ckantest;' -U postgres
- psql -c 'CREATE DATABASE ckantesting;' -U postgres
- psql -c 'CREATE DATABASE datastore;' -U postgres
- psql -c 'CREATE USER readonlyuser;' -U postgres
- python setup.py develop
- paster make-config ckan development.ini --no-interactive
- sed -i -e 's/.*solr_url.*/solr_url = http:\/\/127.0.0.1:8983\/solr/' development.ini
- sed -i -e 's/.*ckan\.site_id.*/ckan.site_id = travis_ci/' development.ini
- sed -i -e 's/^sqlalchemy.url.*/sqlalchemy.url = postgresql:\/\/postgres@localhost\/ckantest/' development.ini
- sed -i -e 's/.*datastore.write_url.*/ckan.datastore.write_url = postgresql:\/\/postgres@localhost\/datastore/' development.ini
- sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/readonlyuser@localhost\/datastore/' development.ini
- cat development.ini
# - sed -i -e 's/.*solr_url.*/solr_url = http:\/\/127.0.0.1:8983\/solr/' development.ini
# - sed -i -e 's/.*ckan\.site_id.*/ckan.site_id = travis_ci/' development.ini
# - sed -i -e 's/^sqlalchemy.url.*/sqlalchemy.url = postgresql:\/\/postgres@localhost\/ckantest/' development.ini
# - sed -i -e 's/.*datastore.write_url.*/ckan.datastore.write_url = postgresql:\/\/postgres@localhost\/datastore/' development.ini
# - sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/readonlyuser@localhost\/datastore/' development.ini
# - cat development.ini
- echo -e "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" | sudo tee /etc/default/jetty
- sudo cp ckan/config/solr/schema-2.0.xml /etc/solr/conf/schema.xml
- sudo service jetty restart
- paster --plugin=ckan db init
- paster db init -c test-core.ini
- paster datastore set-permissions postgres
script: "nosetests --ckan --with-pylons=test-core.ini --nologcapture ckan ckanext"
notifications:
Expand Down
1 change: 1 addition & 0 deletions bin/osx-postgres-mem.sh
Expand Up @@ -14,6 +14,7 @@ case $1 in
${PGCTL} -D ${PGDATA} start
sleep 2;
psql -c "CREATE DATABASE ckantest;" postgres
psql -c "CREATE DATABASE ckantesting;" postgres
;;
stop)
## stop postgres
Expand Down
4 changes: 4 additions & 0 deletions doc/install-from-source.rst
Expand Up @@ -104,6 +104,10 @@ Create the database (owned by ``ckanuser``), which we'll call ``ckantest``::

sudo -u postgres createdb -O ckanuser ckantest -E utf-8

If you are planning to run the test then create a database for them too::

sudo -u postgres createdb -O ckanuser ckantesting -E utf-8

4. Create a CKAN config file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 5 additions & 1 deletion test-core.ini
Expand Up @@ -11,8 +11,12 @@ port = 5000
use = config:development.ini
debug = false

#faster_db_test_hacks = True
# Specify the database for SQLAlchemy to use:
# * Postgres is currently required for a production CKAN deployment
# * Sqlite (memory or file) can be used as a quick alternative for testing
sqlalchemy.url = postgresql://ckanuser:pass@localhost/ckantesting
#sqlalchemy.url = sqlite:///
#sqlalchemy.url = sqlite:///%(here)s/somedb.db

ckan.auth.user_create_organizations = true
ckan.auth.user_create_groups = true
Expand Down

0 comments on commit 6c6c955

Please sign in to comment.