Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DB interactions in TESTS scoped #7

Closed
AKlaus opened this issue Dec 29, 2024 · 0 comments · Fixed by #8
Closed

Make DB interactions in TESTS scoped #7

AKlaus opened this issue Dec 29, 2024 · 0 comments · Fixed by #8
Milestone

Comments

@AKlaus
Copy link
Owner

AKlaus commented Dec 29, 2024

EF Core maintains an internal cache of records that may skew some test results when

  • the DataContext runs a check against the local cache rather than the actual DB;
  • the DataContext's cache is out-of-sync with the DB for some reason.

Steps to mitigate potential issues:

  1. Use AsNoTracking() on querying data that don't require tracking.
  2. Change the test assertion on running against a new instance of DataContext
@AKlaus AKlaus added this to the v4.0 milestone Dec 29, 2024
@AKlaus AKlaus linked a pull request Dec 29, 2024 that will close this issue
@AKlaus AKlaus closed this as completed in #8 Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant