fix(discovery): TransactionTestCase isolation via toxic queue routing#90
Conversation
Tests with @pytest.mark.django_db(transaction=True) commit directly to the database, bypassing savepoint isolation. Mark them as toxic so workers exit after running them, providing process-level DB isolation via the fork-based architecture. Add has_django_transaction_marker() to RunnableTest, wire into both toxicity tagging locations in main.rs. Refs #82
Update _apply_django_db_isolation to close stale database connections even for transaction=True tests before returning. Savepoints are skipped since these tests are now routed to the toxic queue where process-death provides isolation. Closes #82
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
@pytest.mark.django_db(transaction=True)tests as toxic so workers exit after running themCloses #82
How it works
Tests with
transaction=Truecommit directly to the database, bypassing Django's savepoint isolation. Instead of implementing Django'sflushcommand (expensive, complex), we leverage tach's existing toxic queue:transaction=TrueintoMarkerInfohas_django_transaction_marker()onRunnableTestchecks for this markermain.rsORs the existing graph-based check with the marker checkFiles Changed
src/discovery/resolver.rshas_django_transaction_marker()+ 3 unit testssrc/main.rssrc/tach_harness.pyVerification
cargo build✅ |cargo fmt✅ |cargo clippy -D warnings✅ |857/857 tests pass✅