-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #562 from vitorbaptista/544
[#544] Run tests with Postgres 8.4 and 9.1 on Travis
- Loading branch information
Showing
2 changed files
with
59 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh | ||
|
||
# Drop Travis' postgres cluster if we're building using a different pg version | ||
TRAVIS_PGVERSION='9.1' | ||
if [ $PGVERSION != $TRAVIS_PGVERSION ] | ||
then | ||
sudo -u postgres pg_dropcluster --stop $TRAVIS_PGVERSION main | ||
# Make psql use $PGVERSION | ||
export PGCLUSTER=$PGVERSION/main | ||
fi | ||
|
||
# Install postgres and solr | ||
# We need this ppa so we can install postgres-8.4 | ||
sudo add-apt-repository -yy ppa:pitti/postgresql | ||
sudo apt-get update -qq | ||
sudo apt-get install solr-jetty postgresql-$PGVERSION | ||
|
||
# Don't require a password to access DB | ||
sudo sed -i -e 's/ident/trust/g' /etc/postgresql/$PGVERSION/main/pg_hba.conf | ||
|
||
sudo service postgresql reload | ||
|
||
pip install -r pip-requirements.txt --use-mirrors | ||
pip install -r pip-requirements-test.txt --use-mirrors | ||
|
||
psql -c 'CREATE DATABASE ckantest;' -U postgres | ||
psql -c 'CREATE DATABASE datastore;' -U postgres | ||
|
||
python setup.py develop | ||
|
||
# Configure CKAN's configuration file | ||
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@\/ckantest/' development.ini | ||
sed -i -e 's/.*datastore.write_url.*/ckan.datastore.write_url = postgresql:\/\/postgres@\/datastore/' development.ini | ||
|
||
# Configure Solr | ||
echo "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 | ||
|
||
# If Postgres >= 9.0, we don't need to use datastore's legacy mode. | ||
if [ $PGVERSION != '8.4' ] | ||
then | ||
psql -c 'CREATE USER readonlyuser;' -U postgres | ||
sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/readonlyuser@\/datastore/' development.ini | ||
paster datastore set-permissions postgres | ||
fi | ||
|
||
|
||
# And finally, run the tests | ||
nosetests --ckan --with-pylons=test-core.ini --nologcapture ckan ckanext |