dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.68k stars 3.17k forks source link

Cosmos: improve testing speed #33983

Open roji opened 3 months ago

roji commented 3 months ago

It's likely that we have certain tests which take a very long time (possibly anything needing to create databases/containers), but the majority of tests seem to run very fast (e.g. all query tests combined are a small fraction of the total assembly running time). We should find out which tests are the worst offenders and see if there's something we can do about them.

Also, look into enabling test parallelization (this is currently disabled via [assembly: CollectionBehavior(DisableTestParallelization = true)]). As above, it's likely we have some tests which cannot be parallelized, but we do it for those tests only rather than disabling for the entire assembly.

roji commented 3 months ago

Image

roji commented 3 months ago

Here's a test run where tests are grouped by running time. tl;dr aside from Should_throw_if_specified_connection_mode_is_wrong which times out after 10 minutes (possibly related to my VM setup somehow?), OptimisticConcurrencyCosmosTest is the main culprit with 3 minutes, 24 seconds (over 50% of the total test running time if we remove Should_throw_if_specified_connection_mode_is_wrong).

Image

ajcvickers commented 3 months ago

@roji I noticed OptimisticConcurrencyCosmosTest as well.