Project

Profile

Help

Task #6963

closed

Add a function for cleaning up database between migration plugin tests

Added by dkliban@redhat.com almost 4 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Assignee:
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
Sprint:
Sprint 79
Quarter:

Description

Problem

The migration plugin tests need to be able to clean up the Pulp 3 database at the end of most tests.

Solution

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

Rejected solution

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.

Actions #1

Updated by dkliban@redhat.com almost 4 years ago

  • Description updated (diff)
Actions #2

Updated by ttereshc almost 4 years ago

  • Description updated (diff)
  • Groomed changed from No to Yes
  • Sprint set to Sprint 75
Actions #3

Updated by ttereshc almost 4 years ago

  • Sprint/Milestone set to 0.2.0
Actions #4

Updated by rchan almost 4 years ago

  • Sprint changed from Sprint 75 to Sprint 76
Actions #5

Updated by ttereshc almost 4 years ago

  • Priority changed from Normal to High
Actions #6

Updated by rchan almost 4 years ago

  • Sprint changed from Sprint 76 to Sprint 77
Actions #7

Updated by ttereshc over 3 years ago

  • Status changed from NEW to ASSIGNED
  • Sprint changed from Sprint 77 to Sprint 78
Actions #8

Updated by ipanova@redhat.com over 3 years ago

  • Assignee set to ttereshc
Actions #9

Updated by rchan over 3 years ago

  • Sprint changed from Sprint 78 to Sprint 79

Added by ttereshc over 3 years ago

Revision 4ec9a1b3 | View on GitHub

Add a teardown util which removes all data from pulp db.

Run it after each existing test.

closes #6963 https://pulp.plan.io/issues/6963

Added by ttereshc over 3 years ago

Revision 4ec9a1b3 | View on GitHub

Add a teardown util which removes all data from pulp db.

Run it after each existing test.

closes #6963 https://pulp.plan.io/issues/6963

Added by ttereshc over 3 years ago

Revision 4ec9a1b3 | View on GitHub

Add a teardown util which removes all data from pulp db.

Run it after each existing test.

closes #6963 https://pulp.plan.io/issues/6963

Actions #10

Updated by ttereshc over 3 years ago

  • Status changed from ASSIGNED to MODIFIED
  • % Done changed from 0 to 100
Actions #11

Updated by ttereshc over 3 years ago

  • Sprint/Milestone deleted (0.2.0)
Actions #12

Updated by ttereshc over 3 years ago

  • Sprint/Milestone set to 0.3.0
Actions #13

Updated by ttereshc over 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF