Skip to content
Permalink
Browse files

Merge pull request #2470 from SebDieBln/postgrestest

[postgresprovider] make the test more portable
  • Loading branch information
m-kuhn committed Nov 16, 2015
2 parents 526b8fc + ebf132e commit 768bab8644d28a8d0811d485a2ff2c803f8f9949
Showing with 26 additions and 11 deletions.
  1. +0 −1 ci/travis/linux/before_script.sh
  2. +19 −3 tests/README.md
  3. +7 −7 tests/testdata/provider/testdata.sql
@@ -1,5 +1,4 @@
printf "[qgis_test]\nhost=localhost\ndbname=qgis_test\nuser=postgres" > ~/.pg_service.conf
psql -c 'CREATE DATABASE qgis_test;' -U postgres
psql -c 'CREATE EXTENSION postgis;' -U postgres -d qgis_test
psql -f $TRAVIS_BUILD_DIR/tests/testdata/provider/testdata.sql -U postgres -d qgis_test

@@ -36,7 +36,23 @@ Advanced configuration

### Postgres

Make sure that you have enabled building of postgres test in CMake.
`cmake -DENABLE_PGTEST=ON ..`

To test the postgres provider you will need to have a database available to
which the postgres provider can connect. This will need to have postgis support
enabled and be available as a service called `qgis_test` on the machine you run
the tests on.
which the postgres provider can connect. The server will need to have postgis
support enabled.
By default the test uses the following connection options:
dbname='qgis_test'
host=localhost
port=5432
user='postgres'
password='postgres'

If this does not match your setup you can set the environment variable
QGIS_PGTEST_DB to the desired connection string.

Please note that the database needs to be initialized using the sql-script
tests/testdata/provider/testdata.sql
It takes care of activating postgis for the test database and
creates some tables containing test data.
@@ -47,13 +47,13 @@ CREATE TABLE qgis_test."someData" (
-- Data for Name: someData; Type: TABLE DATA; Schema: qgis_test; Owner: postgres
--

COPY qgis_test."someData" (pk, cnt, name, geom) FROM stdin;
5 -200 \N 0101000020E61000001D5A643BDFC751C01F85EB51B88E5340
3 300 Pear \N
1 100 Orange 0101000020E61000006891ED7C3F9551C085EB51B81E955040
2 200 Apple 0101000020E6100000CDCCCCCCCC0C51C03333333333B35140
4 400 Honey 0101000020E610000014AE47E17A5450C03333333333935340
\.
INSERT INTO qgis_test."someData" (pk, cnt, name, geom) VALUES
(5, -200, NULL, '0101000020E61000001D5A643BDFC751C01F85EB51B88E5340'),
(3, 300, 'Pear', NULL),
(1, 100, 'Orange', '0101000020E61000006891ED7C3F9551C085EB51B81E955040'),
(2, 200, 'Apple', '0101000020E6100000CDCCCCCCCC0C51C03333333333B35140'),
(4, 400, 'Honey', '0101000020E610000014AE47E17A5450C03333333333935340')
;


--

0 comments on commit 768bab8

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