Issue 2550705
Created on 2011-05-30 10:16 by tonimueller, last changed 2024-04-22 16:00 by tonimueller.
msg4312 |
Author: [hidden] (tonimueller) |
Date: 2011-05-30 10:16 |
|
roundup's tests for PostgreSQL seem to require that the
'rounduptest' user has the 'CREATE' privilege:
$ ./run_tests.py
Running unit tests at level 1
Running unit tests from /home/toni/mnt/deb/roundup/roundup-1.4.17/.
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning:
Module test was already imported from
+/home/toni/mnt/deb/roundup/roundup-1.4.17/./test/__init__.pyc, but
/usr/lib/pymodules/python2.6 is being added to sys.path
from pkg_resources import resource_stream
Including anydbm tests
Traceback (most recent call last):
File "./run_tests.py", line 886, in <module>
process_args()
File "./run_tests.py", line 876, in process_args
bad = main(module_filter, test_filter, libdir)
File "./run_tests.py", line 668, in main
runner(files, test_filter, debug)
File "./run_tests.py", line 586, in runner
s = get_suite(file)
File "./run_tests.py", line 511, in get_suite
return suite_func()
File
"/home/toni/mnt/deb/roundup/roundup-1.4.17/./test/test_indexer.py", line
195, in test_suite
postgresqlOpener.module.db_nuke(config, 1)
File
"/home/toni/mnt/deb/roundup/roundup-1.4.17/./roundup/backends/back_postgresql.py",
line 48, in db_nuke
db_command(config, command)
File
"/home/toni/mnt/deb/roundup/roundup-1.4.17/./roundup/backends/back_postgresql.py",
line 73, in db_command
raise RuntimeError('10 attempts to create database failed')
RuntimeError: 10 attempts to create database failed
It would be better if the test suite could make use of a pre-existing
database.
|
msg4324 |
Author: [hidden] (ber) |
Date: 2011-07-01 15:32 |
|
How can we completely, securely empty the database, in case we want
to reuse an existing one?
|
msg4342 |
Author: [hidden] (schlatterbeck) |
Date: 2011-07-15 13:06 |
|
This doesn't just happen in the test. The database is dropped and
recreated when you call roundup-admin initialise. So for roundup you
always needed create permission on the database. Maybe someone proposes
a fix (this would be nice for hosting setups where the op doesn't have
create permission).
|
msg4344 |
Author: [hidden] (ber) |
Date: 2011-07-15 14:04 |
|
We could print out the commands necessary when doing an initialisation,
so they could be send to the admin. For the tests, I guess it would be
okay to empty and reuse a database I guess.
|
msg8005 |
Author: [hidden] (rouilj) |
Date: 2024-04-22 15:58 |
|
One additional note, in version 2.4.0 roundup can use a schema in a postgresql
database. issue2550852 has the discussion and links.
This allows the admin to create the database and have the roundup
user work with create schema privs not create database.
My test workflow has:
sudo -u postgres psql -c "CREATE ROLE rounduptest_schema LOGIN PASSWORD
'knownpasswordhere';" -U postgres
sudo -u postgres psql -c "CREATE DATABASE rounduptest_schema;" -U postgres
sudo -u postgres psql -c "GRANT CREATE ON DATABASE rounduptest_schema TO
rounduptest_schema;" -U postgres
to allow creation/deletion of schemas on the database.
Granted this just pushes the grant create down a level but it fulfills the requirement
for postgres testing to use a pre-created database (if you squint hard enough).
I think running:
python -m pytest -k "postgresql and schema" test/test_postgresql.py
python -m pytest -k "not postgresql" test
should provide good test coverage. Patches to add markers
(https://docs.pytest.org/en/7.1.x/example/markers.html) to make this easier
are welcome.
|
msg8006 |
Author: [hidden] (tonimueller) |
Date: 2024-04-22 16:00 |
|
Hi John,
On Mon, Apr 22, 2024 at 03:58:07PM +0000, John Rouillard wrote:
> One additional note, in version 2.4.0 roundup can use a schema in a postgresql
on PyPI, I can not find any version 2.4.0.
> database. issue2550852 has the discussion and links.
But thank you for this information, anyway!
Kind regards,
Toni
|
|
Date |
User |
Action |
Args |
2024-04-22 16:00:54 | tonimueller | set | messages:
+ msg8006 |
2024-04-22 15:58:07 | rouilj | set | nosy:
+ rouilj messages:
+ msg8005 |
2019-09-14 14:08:46 | rouilj | set | title: test requires "CREATE" privilege on Pg -> test requires "CREATE" privilege on Pg - print creation command required for postgresql admin |
2011-07-15 14:04:54 | ber | set | messages:
+ msg4344 |
2011-07-15 13:06:31 | schlatterbeck | set | nosy:
+ schlatterbeck messages:
+ msg4342 |
2011-07-01 15:32:28 | ber | set | nosy:
+ ber messages:
+ msg4324 |
2011-05-30 10:16:10 | tonimueller | create | |
|