Skip to content

Commit

Permalink
Document PostgreSQL test db requirements
Browse files Browse the repository at this point in the history
Test DB needs be accessible via custom username/password,
and the qgis_test service should connect as a user with
the privilege to create other users.

References
#45380 (comment)
  • Loading branch information
strk committed Oct 5, 2021
1 parent 0150ab8 commit ccdf4a5
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tests/README.md
Expand Up @@ -53,11 +53,11 @@ machine does not have an X server. In that case you need to run the test under
Make sure that you have enabled building of postgres test in CMake.
`cmake -DENABLE_TESTS=ON -DENABLE_PGTEST=ON ..`

To test the postgres provider you will need to have a database available to
which the postgres provider can connect. The server will need to have PostGIS
support enabled.
To test the postgres provider you will need to setup a test database
to which the postgres provider can connect.

By default the tests use the following connection string:
By default the tests use the following connection string to access
the test database:

service=qgis_test

Expand All @@ -66,19 +66,26 @@ If these do not match your setup you can set the environment variable
rely on standard libpq environment variables to tweak host, port user
and password (PGHOST, PGPORT, PGUSER, PGPASSWORD).

Please note that the test database needs to be initialized using
the sql-scripts:
The test database must 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.
They take care of activating PostGIS and creating 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

Some tests will attempt to create database users too and expect them to
be allowed to connect using a password.
Most PostgreSQL installation by default use "ident" authentication
model when connecting via unix sockets. Make sure the `qgis_test`
service (or your `QGIS_PGTEST_DB` connection string) uses a connection
method which allows passing username/password pair to connect (and
which allows creating users)

# Write tests

Instructions about writing tests for the processing framework
Expand Down

0 comments on commit ccdf4a5

Please sign in to comment.