Speed up Lite tests: enable parallelization + share DuckDB in FinOpsTests#924
Merged
erikdarlingdata merged 1 commit intodevfrom May 2, 2026
Merged
Speed up Lite tests: enable parallelization + share DuckDB in FinOpsTests#924erikdarlingdata merged 1 commit intodevfrom
erikdarlingdata merged 1 commit intodevfrom
Conversation
…ests The CI test step was averaging ~7 minutes for 257 tests because xUnit's default parallelization was implicit and slow classes (FactCollectorTests, ScenarioTests) blocked the pipeline. Local runs of the full suite went from sequential-feeling runs to ~2m21s with explicit parallelization config. Changes: - Add Lite.Tests/xunit.runner.json with explicit parallelization settings: parallelizeAssembly=true, parallelizeTestCollections=true, maxParallelThreads=-1 (use all cores), parallelAlgorithm=aggressive. CopyToOutputDirectory wired up in the csproj. - Serialize BaselineProviderTests and AnomalyDetectorTests into a shared collection (BaselineProviderCollection, DisableParallelization=true). Both classes mutate the static BaselineProvider.CacheTtl field, so they must run sequentially relative to each other; without this, parallel runs would race on the static state. - Convert FinOpsTests to IClassFixture<FinOpsDuckDbFixture>, sharing one DuckDB across the class. Every seeder in TestDataSeeder.SeedFinOps* already calls ClearTestDataAsync first, so cross-test pollution is prevented without rewriting test code. Saves the schema-init cost on each test (modest, but free). This is a pilot for the IClassFixture approach. The agent's analysis flagged that converting other classes (FactCollectorTests etc.) would require adding ClearTestDataAsync calls to many tests, so leaving those alone for now. Parallel execution across classes is the bigger win and is fully covered by the runner.json settings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 2, 2026
erikdarlingdata
added a commit
that referenced
this pull request
May 2, 2026
Revert PR #924: Lite tests parallelization (slowed CI)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The CI test step was averaging ~7 minutes for 257 Lite tests because xUnit's default parallelization was implicit and slow classes (FactCollectorTests, ScenarioTests) blocked the pipeline. Local runs of the full suite drop to ~2m21s with explicit parallelization config.
Changes
Lite.Tests/xunit.runner.json: explicit parallelization settings (parallelizeAssembly=true,parallelizeTestCollections=true,maxParallelThreads=-1,parallelAlgorithm=aggressive), withCopyToOutputDirectorywired up in the csproj.BaselineProviderCollection: serializeBaselineProviderTestsandAnomalyDetectorTestsinto a shared collection (DisableParallelization=true). Both mutate the staticBaselineProvider.CacheTtlfield, so they must run sequentially relative to each other or they'd race on the static state.FinOpsTests→IClassFixture<FinOpsDuckDbFixture>: shares one DuckDB across the class. Every seeder inTestDataSeeder.Seed*already callsClearTestDataAsyncfirst, so cross-test pollution is prevented without rewriting test code. Saves the schema-init cost on each test.This is a pilot for the IClassFixture approach. Converting other classes (
FactCollectorTestsetc.) would require addingClearTestDataAsynccalls to many tests, so leaving those for a follow-up. The bigger win is parallel execution across classes, which is fully covered by the runner.json settings.Test plan
dotnet test Lite.Tests— 257 passed, 0 failed, 2m 21s locally🤖 Generated with Claude Code