refactor SingleDbTestFixture class to add generic db initialization
This series of commits, along with their counterparts in swh-archiver, swh-indexer, swh-scheduler, swh-storage and swh-vault is the firt step for swh-storage#1265 (closed) (aka kill swh-storage-datatest).
we aim at removing the need for the swh-storage-testdata/dumps files in any test that reauire a pg database.
For this we build the required db based on sql files now shipped within the python package. This require several refactorings of SingleDbTestFixture.setUpClass and .add_db() methods:
- replace the 2 arguments (dump, dump_type) by a single 'dumps' one; this later must be an iterable of couples (dump_file, dump_type)
- refactor all needed helper functions accordingly.
We also add a small helper function to sort numerical file names, and provide a DB_DUMP_TYPES as a global variable to prepare the next commit in which a new cli tool 'swh-db-init' is added.
We also provide a new generic swh-db-init cli tool used to initialise a database for a given (swh) module, like:
swh-db-init storage
Related to swh-storage#1265 (closed).
Test Plan
swh-core tests should still run fine, but this breaks listed packages until other patches are applied.
Migrated from D538 (view on Phabricator)
Merge request reports
Activity
mentioned in commit swh-storage@c4cdb640
Some references in the commit message have been migrated:
- T1265 is now swh-storage#1265 (closed)
Some references in the commit message have been migrated:
- T1265 is now swh-storage#1265 (closed)
mentioned in commit swh-docs@2dbcd491
mentioned in merge request swh-archiver!7 (closed)
mentioned in merge request swh-storage!99 (closed)
mentioned in merge request swh-scheduler!11 (closed)
mentioned in merge request swh-vault!31 (closed)
mentioned in merge request swh-indexer!19 (closed)
mentioned in merge request swh-docs!8 (closed)
mentioned in issue swh-web#1271 (closed)