#18813: TEST_MIRROR functionality broken for sqlite
-------------------------------+--------------------
Reporter: adsva | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I do understand that SQLite doesn't really support replication, so the
test_mirror setting might be a little silly, but I'm using postgres with a
master/slave setup in production and would like to use SQLite when running
the tests for simplicity and performance. Following what seems like a
somewhat common practice of switching the DATABASES setting for testing:
{{{
if 'test' in sys.argv:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
},
"slave": {
"ENGINE": "django.db.backends.sqlite3",
'TEST_MIRROR': 'default',
},
}
}}}
But when I try to use `connections['slave']` after database initialization
is done in the test runner I get an uninitialized in-memory database, and
not the `connections['default']` database. The reason seems to be that the
test runner just copies the name and features of the 'default' connection
to the 'slave' connection. I guess this is sufficient for the other
database engines, where the name ensures the connections use the same
database, but each SQLite connection to ':memory:' gets its own database.
The attached patch changes that behavior to simply point
`connections['slave']` to `connections['master']`, and that seems to solve
the problem, but maybe there was good reason for the current behavior?
--
Ticket URL: <https://code.djangoproject.com/ticket/18813>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.