Skip to content
Permalink
Browse files

Add script to create and initialize postgis test database

  • Loading branch information
Sandro Santilli
Sandro Santilli committed Feb 17, 2016
1 parent bc7036f commit cdf05acac8cf4a9535f1eaed2cda935413bc0902
Showing with 19 additions and 1 deletion.
  1. +7 −1 tests/README.md
  2. +12 −0 tests/testdata/provider/testdata_pg.sh
@@ -52,9 +52,15 @@ If this does not match your setup you can set the environment variable
on standard libpq environment variables to tweak host, port user and
password (PGHOST, PGPORT, PGUSER, PGPASSWORD).

Please note that the database needs to be initialized using the sql-script
Please note that the database needs to be initialized using
the sql-scripts:

tests/testdata/provider/testdata_pg*.sql

They take care of activating postgis for the test database and
create some tables containing test data.

For convenience, a shell script is provided to create the database
and initialize it as needed:

tests/testdata/provider/testdata_pg.sh
@@ -0,0 +1,12 @@
#!/bin/sh

SCRIPTS="
tests/testdata/provider/testdata_pg.sql
tests/testdata/provider/testdata_pg_reltests.sql
tests/testdata/provider/testdata_pg_vectorjoin.sql
"

createdb qgis_test || exit 1
for f in ${SCRIPTS}; do
psql -f $f qgis_test --set ON_ERROR_STOP=1 || exit 1
done

3 comments on commit cdf05ac

@m-kuhn

This comment has been minimized.

Copy link
Member

@m-kuhn m-kuhn replied Feb 17, 2016

Would it make sense to use this script in travis before_script.sh? This would avoid that the next person adding a new sql file forgets to add it in one place or the other.

@strk

This comment has been minimized.

Copy link
Contributor

@strk strk replied Feb 17, 2016

Yes, definitely

@strk

This comment has been minimized.

Copy link
Contributor

@strk strk replied Feb 17, 2016

See #2803

Please sign in to comment.
You can’t perform that action at this time.