mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
Merge pull request #2470 from SebDieBln/postgrestest
[postgresprovider] make the test more portable
This commit is contained in:
commit
768bab8644
@ -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.
|
14
tests/testdata/provider/testdata.sql
vendored
14
tests/testdata/provider/testdata.sql
vendored
@ -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')
|
||||
;
|
||||
|
||||
|
||||
--
|
||||
|
Loading…
x
Reference in New Issue
Block a user