#23718: TEST_MIRROR setting doesn't work as expected
-----------------------------------+-----------------------------
Reporter: coagulant | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Keywords: replica testing
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+-----------------------------
TEST_MIRROR promises "connection to slave will be redirected to point at
default. As a result, writes to default will appear on slave"
I've set up a minimum django project (using postgres backed) to
demonstrate behavior.
{{{
def test_fixture(self):
MyModel.objects.using('default').create(name=1)
MyModel.objects.using('slave').create(name=2)
MyModel.objects.using('slave').create(name=3)
self.assertEqual(list(map(repr,
MyModel.objects.using('default').all())),
list(map(repr,
MyModel.objects.using('slave').all())))
}}}
Both lists should be equal, because replica queries should be hitting
default instead.
It appears not to be the case for Django>=1.4 up to latest 1.7.1 (but
actually passes against 1.3.7)
{{{
AssertionError: Lists differ: ['<MyModel: 1>', '<MyModel: 2>... !=
['<MyModel: 2>', '<MyModel: 3>...
First differing element 0:
<MyModel: 1>
<MyModel: 2>
First list contains 1 additional elements.
First extra element 2:
<MyModel: 3>
- ['<MyModel: 1>', '<MyModel: 2>', '<MyModel: 3>']
? ^ ----------------
+ ['<MyModel: 2>', '<MyModel: 3>']
? ^
}}}
Here is a project I used to test: https://github.com/coagulant/test_mirror
--
Ticket URL: <https://code.djangoproject.com/ticket/23718>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.f211cf312c0f9d8458085f5c81e1cf45%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.