Setup of dotnet 7 project:
<namespace>.Api
<namespace>.Api.Test
I started with an integration test, within <namespace>.Api.Test
project.
The integration test basically starts the whole application (<namespace>.Api
), creates a HttpClient
and communicates to the REST Api from <namespace>.Api
project.
After first good results, I decided to create an own project for integration tests:
<namespace>.Api.Integration
... where the new project has same packages as <namespace>.Api.Test
.Dragged the relevant class in VS 2022 to <namespace>Api.Integration
(which copies the file), renamed the test class + method to some unique values.
Now, when starting the new version of the test, application startup takes 2 minutes, whereas starting from old <namespace>.Api.Test
only takes 7 seconds.
During startup, a bunch of db operations is performed (and logged) sequentially. In both cases, same db operations are performed against same fresh and local database.
What's happening in the test looks very well.
Do you have any idea what could be the issue here?
Already tried:
dotnet test
has same resultsFound the issue myself:
I managed that server app, started from integration test in a dedicated thread, started another thread that was stuck in an endless loop searching for files on hard disk without any break.
It seems that this loop consumed too much CPU which slowed down the whole system.