Skip to content

Reduce local and Helix test setup overhead - #56016

Merged
Evangelink merged 3 commits into
mainfrom
dev/amauryleve/test-performance-pr
Sep 14, 2026
Merged

Evangelink merged 3 commits into
mainfrom
dev/amauryleve/test-performance-pr

Conversation

@Evangelink

@Evangelink Evangelink commented Aug 29, 2026 •

Copy link
Copy Markdown
Member

Summary

This standalone PR addresses fixed test setup costs and over-sharding. The in-process parallelization work formerly tracked in #56015 has been split into owner-aligned PRs.

The change:

  • generates the final Helix NuGet.config once before work-item creation instead of running a sequence of dotnet nuget commands in every item;
  • installs Node only in the shard containing Microsoft.NET.Sdk.StaticWebAssets.Tests.TypeScriptIntegrationTest;
  • removes an obsolete NuGet cache scan from every Windows work item;
  • conservatively consolidates shards for the assemblies with the clearest over-sharding;
  • adds local scripts/RunTests.cs --repeat N, which builds once and retains separate per-iteration TRX output and timings.

Observations and methodology

I analyzed recent successful dotnet-sdk-public-ci builds 1571833 and 1573234, using build 1572757 as the base comparison. The analysis used Helix REST work-item details, console logs, and TRX start/end intervals rather than relying only on top-level Azure DevOps job durations.

Across the sampled runs:

Queue Work items Machine-minutes Median item duration
Windows x64 225 664 2.41m
Linux x64 227 477 1.03m

The fixed setup floor was approximately 33s Windows and 12s Linux before useful test execution. Every shard ran 18-20 sequential dotnet nuget processes to rewrite the same configuration. Windows also downloaded and extracted Node for every shard even though only TypeScriptIntegrationTest uses it. In addition, an obsolete NuGet cache scan dating from 2022 ran after every Windows item.

The clearest over-sharding counts were 53 work items for dotnet.Tests, 24 for NetAnalyzers, 17 for Static Web Assets, and 16 for Microsoft.NET.Build.Tests. These counts motivated conservative multiplier changes rather than broad repartitioning.

macOS agent wait ranged from 0.1m to 66.6m. That is external capacity delay, not test execution overhead, and this PR does not attempt to address it.

Implementation details

PrepareHelixNuGetConfig writes the final configuration once into the shared payload. It retains only the required original feeds and adds the SDK-under-test and test-package sources using %DOTNET_ROOT% and %DOTNET_SDK_TEST_EXECUTION_DIRECTORY%. NuGet officially uses %NAME% environment-variable expansion in configuration files across platforms, so the generated file is shared by Windows, Linux, and macOS.

Node metadata is attached only to the Static Web Assets project, and work-item generation prepends setup only when the partition contains TypeScriptIntegrationTest. The per-item NuGet CLI rewrite and the obsolete post-test cache scan are removed. Shard multipliers are increased only for the assemblies called out above, preserving multiple workers for the longer integration-test tails.

For local investigation, RunTests.cs --repeat N performs the incremental project build once, executes the selected tests N times, retains separate TRX files for each iteration, reports each iteration's timing, and prints aggregate mean/min/max timing. This avoids including repeated build time in flake or performance samples.

Completed companion benchmark

The companion in-process parallelization work was measured independently on the same machine under an exclusive lock. This does not attribute those gains to this PR's Helix setup and sharding changes; it supplies the complete before/after evidence that motivated and accompanied this performance work.

Iteration Baseline Changed Faster
1 14,445.996s 5,426.805s 62.43%
2 14,623.484s 5,474.194s 62.57%
3 18,277.595s 5,427.590s 70.30%
4 15,025.700s 5,564.956s 62.96%
5 14,223.415s 7,144.008s 49.77%
6 14,329.105s 10,443.242s 27.12%
7 14,195.653s 10,078.456s 29.00%
8 14,201.918s 9,747.667s 31.36%
9 14,193.833s 7,766.318s 45.28%
10 14,221.670s 6,341.924s 55.41%
Fleet statistic Baseline Changed Improvement
Mean 14,773.837s 7,341.516s 50.31%
Median 14,276.260s 6,742.966s 52.77%
Min / max 14,193.833s / 18,277.595s 5,426.805s / 10,443.242s —
Population std dev 1,194.708s 1,951.718s —

All 10 changed iterations completed without timeouts and retained the exact baseline 10-project local-environment/prerequisite failure set. A separate NetAnalyzers 10× run completed with exit code 0 every time: median 364.287s → 121.878s (66.54% faster) and mean 402.691s → 122.301s (69.63% faster).

The local --repeat implementation was also covered by focused script tests, and unified build 1575047 succeeded. No dotnet-sdk-public-ci Helix run was triggered for this PR, so post-change Helix setup/shard effects remain to be measured from a future public CI run and are not inferred from the local benchmark.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a8f51e3d-8b26-4df0-b2e9-fb2d09921b41
@Evangelink
Evangelink force-pushed the dev/amauryleve/test-performance-pr branch from f361c67 to b3028db Compare August 31, 2026 07:54
@Evangelink
Evangelink changed the base branch from dev/amauryleve/parallel-test-pr to main August 31, 2026 07:56
@Evangelink
Evangelink marked this pull request as ready for review August 31, 2026 08:11
@Evangelink
Evangelink requested a review from mthalman as a code owner August 31, 2026 08:11
Copilot AI lite review requested due to automatic review settings August 31, 2026 08:11
@Evangelink
Evangelink requested a review from lbussell as a code owner August 31, 2026 08:11
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity test/​Microsoft.NET.Infrastructure.Tests/​PrepareHelixNuGetConfigTests.cs — PrepareHelixNuGetConfigTests uses XDocument/XElement but does not import System.Xml.Linq, which…
What changed in this PR

This PR reduces fixed overhead in local and Helix test execution by moving per-work-item setup into shared payload preparation, avoiding unnecessary Node installation, and adding a local --repeat mode to re-run tests without rebuilding each time.

Changes:

  • Generate a final Helix NuGet.config once (via a new MSBuild task) and stop rewriting sources in every work item.
  • Install Node only for the Static Web Assets shard that contains the TypeScript integration test, and remove an obsolete Windows post-test NuGet cache scan.
  • Add scripts/RunTests.cs --repeat N and update infra tests/docs to cover and describe the behavior.
File Description
test/​UnitTests.proj Adjusts shard multipliers, adds Node-only metadata for a specific test class, and generates the Helix NuGet.config once into the payload.
test/​test-runner/​TestRunner.targets Registers the new PrepareHelixNuGetConfig MSBuild task for use in the test runner targets.
test/​Microsoft.NET.Infrastructure.Tests/​RunTestsScriptTests.cs Extends runner tests to cover --repeat help text, validation, and repeated execution behavior.
test/​Microsoft.NET.Infrastructure.Tests/​PrepareHelixNuGetConfigTests.cs Adds a new unit test validating the generated Helix NuGet.config sources.
test/​Microsoft.NET.Infrastructure.Tests/​Microsoft.NET.Infrastructure.Tests.csproj Adds references needed to test HelixTasks and MSBuild task types.
test/​HelixTasks/​PrepareHelixNuGetConfig.cs New MSBuild task that edits NuGet.config sources for the Helix environment and adds required local sources.
test/​HelixTasks/​CreateHelixTestWorkItems.cs Adds per-partition Node installation prefixing based on the partition filter content and new item metadata.
scripts/​RunTests.cs Adds --repeat N to build once and run the selected tests multiple times with per-iteration TRX and timings.
documentation/​project-docs/​developer-guide.md Documents --repeat N behavior for local test runner usage.
build/​SetupHelixEnvironment.sh Removes per-item NuGet source rewriting and Node install; ensures Testpackages directory exists.
build/​SetupHelixEnvironment.cmd Same as above for Windows work items; ensures Testpackages directory exists.
.github/​skills/​run-tests/​SKILL.md Updates the run-tests skill guidance to mention the single-build + --repeat workflow.

@Evangelink
Evangelink enabled auto-merge (squash) August 31, 2026 14:36
@Evangelink

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

@Evangelink
Evangelink disabled auto-merge September 11, 2026 13:34
@Evangelink
Evangelink enabled auto-merge (squash) September 11, 2026 13:34
@Evangelink Evangelink closed this Sep 11, 2026
auto-merge was automatically disabled September 11, 2026 13:40

Pull request was closed

@Evangelink Evangelink reopened this Sep 11, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@Evangelink
Evangelink enabled auto-merge (squash) September 13, 2026 07:37
@Evangelink
Evangelink requested a review from a team as a code owner September 13, 2026 16:31
@Evangelink
Evangelink merged commit fe9bbf2 into main Sep 14, 2026
25 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/test-performance-pr branch September 14, 2026 15:48
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 15, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 70ec82ee Deployed Sep 14, 2026 by Evangelink via pre_activation #4770
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants