celery / django-celery-results

Celery result back end with django
Other
684 stars 203 forks source link

Fix atomic transaction not routing to the the correct DB #324

Closed nofalx closed 2 years ago

nofalx commented 2 years ago

This to fix the issue explained at: https://github.com/celery/django-celery-results/issues/323

nofalx commented 2 years ago

I have added a new test class and a db router as these are required to test this specific scenario

using make test

The test passes after the edits to the manager.py file

before the changes I added to manager.py the test fails with the below error:

FAILED t/unit/test_models.py::test_ModelsOnSecondaryDbOnly::test_operations_with_atomic_transactions - AssertionError: Database connections to 'default' are not allowed in this test. Add 'default' to t.unit.test_models.test_ModelsOnSecondaryDbOnly.databases to ensure proper test isolation and silence this failure.

Screenshot from 2022-06-21 13-50-10