Closed fiseni closed 10 months ago
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.
System.Data.SqlClient.SqlException : Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=20164; handshake=24;
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 testingInclude
features).ReadCollection
that is utilized for all repository read actions.ClassFixture
instead.EF Core
andEF6
are consistent now.