A testing-only transaction manager which replaces nested transactions with savepoints
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading IDbContextTransactionManager and the existing transaction abstractions in EF Core, then review the related discussion in Npgsql issue 3982. Define how a testing-only manager would represent nested transactions as savepoints and prevent commits; done means integration tests can manage transactions, roll back safely, and run without database reset interference or disabled parallelization.
Written by the indexing model from the issue text.
Description
It is currently a bit challenging to write integration tests for (user) product code which explicitly manages transactions. Since database don't support nested transactions, users can't run the entire test in a transaction and roll it back (to avoid test interference, as can be done with tests which don't manage transactions). This causes the following difficulties:
- The database needs to be reverted to its initial state after every test runs, which can be tricky.
- Test parallelization must be disabled.
We could provide an IDbContextTransactionManager which "implements" nested transactions as savepoints. That is, if BeginTransaction is called and a transaction already exists, we could create a savepoint instead. This would allow the test to fully manage transactions, but without ever actually committing anything, working around the issues above.
Originally discussed in https://github.com/npgsql/npgsql/issues/3982
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 134
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/efcore
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
customer-reported
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
area-cosmos area-vector-search
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-cosmos
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-tools needs-design
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100