Skip to content

Parallelize AspNetCore 3.x E2E tests to cut CI runtime from ~3.4h to ~12min - #2906

Open
WanjohiSammy wants to merge 1 commit into
masterfrom
fix/e2e-test-parallelization
Open

Parallelize AspNetCore 3.x E2E tests to cut CI runtime from ~3.4h to ~12min#2906
WanjohiSammy wants to merge 1 commit into
masterfrom
fix/e2e-test-parallelization

Conversation

@WanjohiSammy

@WanjohiSammy WanjohiSammy commented Jul 20, 2026

Copy link
Copy Markdown
Member

Issues

The Core E2E 3x Tests pipeline step (Microsoft.Test.E2E.AspNetCore3x.OData.csproj) runs the ~4900-test suite serially for ~3.4 hours on the Microsoft-hosted agent.

Description

Enable xUnit parallelism for the AspNetCore 3.x E2E project only and harden test isolation so the suite is stable under concurrency. Test-only change - no product code is modified.

Root cause of the 3.4h: WebHostTestFixture applied [assembly: CollectionBehavior(CollectionPerAssembly, MaxParallelThreads = 1)], forcing fully serial execution. Naive parallelism deadlocks instead, because many EF test classes concurrently DROP/CREATE the single shared (LocalDb)\MSSQLLocalDB instance.

Changes:

  • Parallelism, scoped to 3.x (#if NETCORE && !NETCORE2x) with a moderate cap: [assembly: CollectionBehavior(MaxParallelThreads = 4)]. Classic (.NET Framework) and AspNetCore 2.x keep the original serial behavior.
  • Serialize shared-state tests into one [Collection("Database")] (24 classes) so they never run concurrently: all EF/LocalDB-backed classes, plus the former Aggregation (shared static state) and TimeZoneTests (process-global TimeZoneInfo) collections - folded together because DateAndTimeOfDayTest is both EF- and TimeZone-sensitive. In-memory classes stay parallel; Singleton/Batch/JsonLightMetadata collections unchanged.
  • Stability hardening: pin ModelBoundQuerySettings CombinedTest model MaxTop (process-global default could leak across concurrent servers); raise PortArranger reserve-retry budget (10 → 200); accept a connection reset in the oversized-header DoS test.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

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 this pull request may close these issues.

1 participant