Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add script to create and initialize postgis test database
  • Loading branch information
Sandro Santilli committed Feb 17, 2016
1 parent bc7036f commit cdf05ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/README.md
Expand Up @@ -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
12 changes: 12 additions & 0 deletions 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
Copy link
Member

@m-kuhn m-kuhn commented on cdf05ac Feb 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

@strk strk commented on cdf05ac Feb 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely

@strk
Copy link
Contributor

@strk strk commented on cdf05ac Feb 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2803

Please sign in to comment.