Skip to content

Parallelize Web SDK publish task tests - #56037

Merged
Evangelink merged 1 commit into
dotnet:mainfrom
Evangelink:dev/amauryleve/web-sdk-parallel-tests
Sep 9, 2026
Merged

Evangelink merged 1 commit into
dotnet:mainfrom
Evangelink:dev/amauryleve/web-sdk-parallel-tests

Conversation

@Evangelink

@Evangelink Evangelink commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Summary

This is the web-sdk CODEOWNERS split from #56015 for @vijayrkn.

  • Enables ClassLevel parallel execution for Microsoft.NET.Sdk.Publish.Tasks.Tests.
  • Isolates EnvironmentHelperTests process-wide environment-variable mutation with a resource lock and restores the original value in a finally block.

10× benchmark results

The combined Razor-fixed branch was measured on the same machine under an exclusive benchmark lock. Each iteration ran the identical 54 affected projects sequentially through scripts/RunTests.cs, with the same 90-minute per-project timeout and the same exclusion for the pre-existing hanging interruption test.

Fleet statistic Baseline Changed Improvement
Mean 14,773.837s 7,341.516s 50.31%
Median 14,276.260s 6,742.966s 52.77%
Min 14,193.833s 5,426.805s —
Max 18,277.595s 10,443.242s —

All 10 changed iterations completed with zero timeouts and retained exactly the same 10-project local-environment/prerequisite failure set as all 10 baseline iterations; there were no new or resolved failing projects. These combined-branch measurements provide performance and stability context, not isolated attribution or a per-slice tests-passed claim.

Publish Tasks improved from 91.289s to 60.488s (33.74%). The separate Web SDK integration project changed from 76.554s to 87.752s in the complete 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.

@Evangelink
Evangelink marked this pull request as ready for review August 31, 2026 17:01
@Evangelink
Evangelink requested a review from vijayrkn as a code owner August 31, 2026 17:01
Copilot AI lite review requested due to automatic review settings August 31, 2026 17:01
@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.

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

🟢 Approval recommended

Review tier: Lite
Findings: None

What changed in this PR

Enables safe parallel execution for the Microsoft.NET.Sdk.Publish.Tasks.Tests MSTest project by opting into class-level parallelization and serializing the one test class that mutates process-wide environment variables while ensuring the original value is restored.

Changes:

  • Opt into MSTest ClassLevel parallelization for Microsoft.NET.Sdk.Publish.Tasks.Tests.
  • Add a [ResourceLock(WellKnownResources.EnvironmentVariables)] to EnvironmentHelperTests and wrap environment-variable mutation in a try/finally restore.
File Description
test/​Microsoft.NET.Sdk.Publish.Tasks.Tests/​Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj Opts this test project into MSTestParallelizeScope=ClassLevel to enable parallel execution.
test/​Microsoft.NET.Sdk.Publish.Tasks.Tests/​EnvironmentHelperTests.cs Adds an environment-variable resource lock and ensures the original env var value is restored via finally.

@Evangelink

Copy link
Copy Markdown
Member Author

Local before/after benchmark

Local gain confirmed on my Windows machine using the SDK repo test runner.

  • Machine: Microsoft Windows 11 Enterprise, AMD RYZEN AI MAX+ 395 w/ Radeon 8060S , 32 logical processors
  • Baseline: origin/main (890dd7f)
  • PR head: dev/amauryleve/web-sdk-parallel-tests (8d03136)
  • Command shape: .\.dotnet\dotnet.exe scripts\RunTests.cs -- --project <project>
  • Reported numbers use the test run duration from the runner output; build/setup wall-clock is excluded.

Comparable clean total: 1m 21.2s before -> 48.782s after (32.403s saved, 39.9%).

Project Before After Delta Result
Microsoft.NET.Sdk.Publish.Tasks.Tests 1m 21.2s 48.782s 32.403s passed

Single local run; timings can vary with machine load, but this gives a direct before/after signal on this machine.

@Evangelink
Evangelink merged commit 54cc159 into dotnet:main Sep 9, 2026
27 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 10, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 8d03136b Deployed Sep 9, 2026 by Evangelink via pre_activation #3615
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