Add a function for cleaning up database between migration plugin tests
The migration plugin tests need to be able to clean up the Pulp 3 database at the end of most tests.
A new function needs to be written that is going to remove data from all the tables that are involved in the migration. This function needs to load a list of tables by looking at all the available models from the pulpcore app config. SQL code should be generated to delete everything from each of the tables associated with each of the models.
We can probably reuse a lot of the code from the Django flush command: https://github.com/django/django/blob/master/django/core/management/commands/flush.py#L27
Using django reset_db requires all connections to the db being closed, it means that pulp workers needs to be down. It seems not time effective to that (stop services, clean db, run migrations,start services) for every test or every group of tests.
Updated by ttereshc about 2 years ago
- Status changed from ASSIGNED to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp:pulp-2to3-migration|4ec9a1b3a1184ce13efa2450bbb59f62c0ff715d.