* Fixtures cannot be loaded: foreign keys are not found. From what I see,
loaddata command is placed inside a transaction.atomic block, so that
would make sense. However, in a different, more simple project, with a
couple of models and fixtures with foreign keys, fixtures DO work, so I'm
not sure what the issue is.
* If I try to manually load the fixtures in setUp (calling loaddata
command manually), something strange happens: for the first test of a
given TransactionTestCase, I have the same issue that above: any fixture
referencing an afore loaded object loaded through a FK fails because said
object is not found. However, the manual fixture loading does work for the
rest of the tests. It's hard to understand why.
* Some tests fail because the replica database does not find an object.
For example, I create an object and then try to retrieve it, and the
object is not found. Through debugging, the object is correctly created in
the primary db, but for some reason not replicated in the other one. A
very strange thing is that this happens when I run this TestCase in
particular, when I run all my tests, that same test passes.
There is something not deterministic about tests failing when using this
architecture, and I believe it mainly has to do with data not being
replicated for some reason. I believed I followed the instructions
correctly, using TransactionTestCase instead of TestCase, and setting up
the replica to mirror the default database. Like I said, in my other
simple project, things do work as expected: non of the above issues is
raised (using the same Python, PostgreSQL and libraries' versions). Any
help would be appreciated.
--
Ticket URL: <https://code.djangoproject.com/ticket/34490>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
Hello Andres!
Thank you for your report, though I think this request for help would be
best handled in any of the django users groups. You could either join the
Django Forum or the django-users mailing list, and send details about your
issue (see [[https://docs.djangoproject.com/en/4.2/internals/contributing
/#join-the-django-community|this link]] for more details).
I'll be closing this issue as Invalid, but if you find out that this is
really a bug in Django itself, feel free to re-open this ticket with steps
to reproduce the problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/34490#comment:1>