mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-06 00:03:16 -05:00
Create a test unprivileged user for PostgreSQL tests
This commit is contained in:
parent
d57f9f9918
commit
5d45650d6c
14
tests/testdata/provider/testdata_pg.sh
vendored
14
tests/testdata/provider/testdata_pg.sh
vendored
@ -57,11 +57,11 @@ EOF
|
|||||||
|
|
||||||
# Test service=qgis_test connects to the just-created database
|
# Test service=qgis_test connects to the just-created database
|
||||||
echo "Checking if we can connect to ${DB} via service=qgis_test"
|
echo "Checking if we can connect to ${DB} via service=qgis_test"
|
||||||
CHECK=$(psql -XtA 'service=qgis_test' -c "select val from qgis_test.schema_info where var='fingerprint'")
|
CHECK=$(psql -wXtA 'service=qgis_test' -c "select val from qgis_test.schema_info where var='fingerprint'")
|
||||||
if test "${CHECK}" != "${FINGERPRINT}"; then
|
if test "${CHECK}" != "${FINGERPRINT}"; then
|
||||||
exec >&2
|
exec >&2
|
||||||
echo "ERROR: Could not access the just created test database ${DB} via service=qgis_test"
|
echo "ERROR: Could not access the just created test database ${DB} via service=qgis_test"
|
||||||
echo "HINT: create a section like the following in ~/.pg_service.conf"
|
echo "HINT: setup a section like the following in ~/.pg_service.conf"
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
[qgis_test]
|
[qgis_test]
|
||||||
host=localhost
|
host=localhost
|
||||||
@ -73,15 +73,15 @@ EOF
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Test service=qgis_test connects via a method which accepts
|
# Test service=qgis_test connects via a method which accepts
|
||||||
# username/password
|
# username/password
|
||||||
CHECK=$(psql -XtA 'service=qgis_test user=qgis_test_user password=qgis_test_user_password' -c "select version()")
|
CHECK=$(psql -wXtA 'service=qgis_test user=qgis_test_unprivileged_user password=qgis_test_unprivileged_user_password' -c "select version()")
|
||||||
if test -z "${CHECK}"; then
|
if test -z "${CHECK}"; then
|
||||||
exec >&2
|
exec >&2
|
||||||
echo "ERROR: Could not access the just created test database ${DB} via service=qgis_test and overriding username/password"
|
echo "ERROR: Could not access the just created test database ${DB} via service=qgis_test and overriding username/password"
|
||||||
echo "HINT: make sure MD5 method is accepted in pg_hba.conf "
|
echo "HINT: make sure password based methods ( scram-sha-256, md4 ) are accepted in pg_hba.conf"
|
||||||
echo "(specifying host=localhost in the [qgis_test] section of "
|
echo " for the kind of connection used by the [qgis_test] section of ~/.pg_service.conf"
|
||||||
echo "'~/.pg_service.conf' often does help)"
|
echo " Specifying host=localhost often helps."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
7
tests/testdata/provider/testdata_pg_role.sql
vendored
7
tests/testdata/provider/testdata_pg_role.sql
vendored
@ -1,5 +1,10 @@
|
|||||||
DROP GROUP IF EXISTS qgis_test_group;
|
DROP GROUP IF EXISTS qgis_test_group;
|
||||||
|
CREATE USER qgis_test_group NOLOGIN;
|
||||||
|
|
||||||
DROP USER IF EXISTS qgis_test_user;
|
DROP USER IF EXISTS qgis_test_user;
|
||||||
CREATE USER qgis_test_user PASSWORD 'qgis_test_user_password' LOGIN;
|
CREATE USER qgis_test_user PASSWORD 'qgis_test_user_password' LOGIN;
|
||||||
CREATE USER qgis_test_group NOLOGIN;
|
|
||||||
ALTER GROUP qgis_test_group ADD USER qgis_test_user;
|
ALTER GROUP qgis_test_group ADD USER qgis_test_user;
|
||||||
|
|
||||||
|
DROP USER IF EXISTS qgis_test_unprivileged_user;
|
||||||
|
CREATE USER qgis_test_unprivileged_user WITH PASSWORD
|
||||||
|
'qgis_test_unprivileged_user_password' LOGIN;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user