Opened 9 years ago

Last modified 11 months ago

#25540 new Bug

Reusing databases doesn't work on PostgreSQL for migrations tests

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Ülgen Sarıkavak Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:How to create a pull request

Description (last modified by Claude Paroz)

Running migrations tests with keepdb results in failures for the second run. To reproduce:

./runtests.py --settings=<your_postgresql_settings> --keepdb migrations
# success
./runtests.py --settings=<your_postgresql_settings> --keepdb migrations
# Lots of failures.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (5)

comment:1 by Claude Paroz, 9 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

This also happens on 1.8.

comment:2 by Claude Paroz, 9 years ago

Description: modified (diff)

by Tim Graham, 8 years ago

Attachment: 25540-init.diff added

comment:3 by Tim Graham, 8 years ago

Component: Testing frameworkMigrations

I attached a patch to get someone started. I used the following workflow:

./runtests.py --settings=test_postgres migrations --parallel=1 --noinput --keepdb --failfast
(no errors)
./runtests.py --settings=test_postgres migrations --parallel=1 --noinput --keepdb --failfast

At this point you can observe and fix the next failure. With my patch applied, the next failure I see is test_regression_22823_unmigrated_fk_to_migrated_model (migrations.test_commands.MigrateTests). It's helpful to use pgAdmin to examine the state of the test database.

After you add a possible fix for thetest, run the tests without --keepdb to clear the bad state from the database. You can then repeat these steps from the top.
./runtests.py --settings=test_postgres migrations --parallel=1 --noinput

comment:4 by Ülgen Sarıkavak, 11 months ago

Cc: Ülgen Sarıkavak added
Note: See TracTickets for help on using tickets.
Back to Top