-
Notifications
You must be signed in to change notification settings - Fork 253
Refactor and improve integration test fixtures. #360
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
Conversation
|
Note to self: The connection to the database fails. It happens randomly for a given project, usually 2 of them succeed completely and 1 one of them fails (and they shift randomly). I suspect now that we're creating DbContext for each test separately, we face connection pool exhaustion perhaps? Btw, locally there is no issue at all; neither running from Test Explorer, nor through cli, nor through Docker. It has to do something with the environment in CI. |
ardalis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not loving having to add 2 lines to every test for the dbContext but I get it...
Closes #359. More details on the related issue.
This PR contains the following improvements.
DatabaseFixture. We'll create a unique database per each instance, and we'll delete the database on disposal.HasData).DbContext, instead, we create a separate context for each test. This will lead to more reliable tests (especially while testingIncludefeatures).ReadCollectionthat is utilized for all repository read actions.ClassFixtureinstead.EF CoreandEF6are consistent now.