Conversation
…delete calls when cleaning up test data.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR addresses intermittent deadlocks in the integration test suite that surfaced when tests ran in parallel. The root cause was identified as Code Review DetailsNo findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7478 +/- ##
==========================================
+ Coverage 58.75% 63.59% +4.84%
==========================================
Files 2071 2078 +7
Lines 91252 91526 +274
Branches 8130 8141 +11
==========================================
+ Hits 53611 58206 +4595
+ Misses 35726 31308 -4418
- Partials 1915 2012 +97 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
New Issues (1)Checkmarx found the following issues in this Pull Request
|
|
https://kevsoft.net/2025/05/14/banning-api-calls-in-dotnet-without-writing-your-own-analyzer.html Could we add the banned API analyzer to our integration tests, so that we get an immediate red flag warning if we try to use the method that causes deadlocks? It's a Microsoft package, but not sure if there's some difficulties with adding it. We would also need to just bypass the warnings for the test files that are trying to test this method. |
That could definitely be something added later on. We'd have to review the package and document the tool for potentially more future uses. @sven-bitwarden |
There was a problem hiding this comment.
As discussed, most of these calls are because we delete our test data after each test. However, test databases should be treated as ephemeral; cleaning up our own test data just makes tests slower and competes for locks.
Please delete all test cleanup logic instead. If we're still having deadlock issues, that should ideally be addressed at a more general level (e.g. how testing framework or the db is configured).
050e2fb
|





🎟️ Tracking
PM-25056
📔 Objective
This identified the root cause for the testing framework deadlock.
When tests are being run in parallel, tests that called
OrganizationRepo.DeleteAsyncwould call the giant sproc that would go across all the other tables to clean up related data. Each opened up its own transaction and would lock tables. This caused the intermittent deadlocks across the different tests as they were all locking and trying to delete records in the same tables.