Opened 9 years ago
Last modified 9 years ago
#25647 closed Bug
Regression with TEST MIRROR database migrations — at Initial Version
Reported by: | Gavin Wahl | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.9b1 |
Severity: | Release blocker | Keywords: | |
Cc: | Aymeric Augustin | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a project with two databases: 'default' and 'logging', where logging is just an alias for default (to allow writing to logging while in a transaction in default). I have logging has 'TEST': {'MIRROR': 'default'}
, and a database router that doesn't allow migrating on logging.
When running the tests, migrations randomly fail to run. This is because get_unique_databases
stores all the aliases for a specific database in a set, and then setup_databases
migrates on the 'first' one, despite sets not having a 'first' element. This randomly, based on hash randomization in python, picks either 'default' or 'logging' to be migrated. When 'logging' is migrated, all the migrations are no-ops because migrating is turned off for 'logging'.
I believe this is a regression introduced in 49eee8424.