Skip to content

Parallelize container integration tests - #56033

Merged
Evangelink merged 2 commits into
mainfrom
dev/amauryleve/container-parallel-tests
Sep 9, 2026
Merged

Evangelink merged 2 commits into
mainfrom
dev/amauryleve/container-parallel-tests

Conversation

@Evangelink

@Evangelink Evangelink commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Summary

This replacement split carries only the containers slice from #56015. It enables class-level execution for the container integration-test assembly while isolating registry repositories, image names, container names, test artifacts, and binlogs with per-run identifiers.

Tests that use the local Docker daemon declare the narrow shared DockerDaemon resource lock. LayerEndToEndTests remains serialized because product code reads the process-wide ContentStore.ArtifactRoot state and cannot participate in a test resource lock.

Ownership

@dotnet/sdk-container-builds-maintainers

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.

The container integration project median changed from 127.982s to 135.466s (7.484s / 5.85% slower) in the complete benchmark; its baseline and changed runs both retained the same expected local Docker-prerequisite failure status.

CI regression fix validation

The first Helix run exposed a process-wide in-process MSBuild collision between ParseContainerPropertiesTests and TargetsTests: concurrent ProjectInstance.Build calls failed with “a build is already in progress.” Commit f0edffc32aa72f566ffef5efe3dc8880f351b330 adds a narrow shared MSBuildBuildManager resource lock only to those two classes.

A focused run of both classes passed 117/117 tests with 0 failures and 0 skips in 13.857s. Replacement CI build 1575621 confirmed the container work items no longer fail; its only red work item was unrelated dotnet-new.IntegrationTests.dll.1 on Linux (exit 7).

@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: c74c9edf-fd7a-4f16-b029-c0a50062f994
@Evangelink

Copy link
Copy Markdown
Member Author

Local before/after benchmark

No local gain in this run 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/container-parallel-tests (f0edffc)
  • 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: 13.974s before -> 15.519s after (-1.545s saved, -11.1%).

Project Before After Delta Result
Microsoft.NET.Build.Containers.IntegrationTests 13.974s 15.519s -1.545s passed; slower in this run

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

@Evangelink
Evangelink marked this pull request as ready for review September 9, 2026 05:53
@Evangelink
Evangelink requested a review from a team as a code owner September 9, 2026 05:53
Copilot AI lite review requested due to automatic review settings September 9, 2026 05:53
@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 found no correctness or concurrency gaps beyond the intentionally scoped locks and per-run isolation introduced with the new parallelization setting.

Review tier: Lite
Findings: None

What changed in this PR

Enables class-level parallel execution for Microsoft.NET.Build.Containers.IntegrationTests while adding per-run isolation (artifacts/binlogs/image+container identifiers) and applying targeted resource locks to avoid known shared-resource collisions (Docker daemon and MSBuild BuildManager).

Changes:

  • Enable MSTest class-level parallelization for the containers integration test project.
  • Introduce a per-test-run identifier and use it to isolate artifact directories, binlog paths, image names, and container names.
  • Add resource locks to serialize tests that share the Docker daemon or MSBuild ProjectInstance.Build/BuildManager.
File Description
test/​Microsoft.NET.Build.Containers.IntegrationTests/​TestSettings.cs Adds shared resource names and a per-run TestRunId; switches artifacts directory to use the run id.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​Microsoft.NET.Build.Containers.IntegrationTests.csproj Opts the assembly into MSTest class-level parallelization.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​ProjectInitializer.cs Isolates binlog output with unique names and routes logs under the per-run artifacts directory.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​TargetsTests.cs Serializes this class under an MSBuild BuildManager resource lock to avoid concurrent build collisions.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​ParseContainerPropertiesTests.cs Serializes this class under the same MSBuild BuildManager resource lock.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​LayerEndToEndTests.cs Marks this class [DoNotParallelize] due to process-global ContentStore.ArtifactRoot usage.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​EndToEndTests.cs Applies Docker daemon resource lock and appends run id to repositories and container names used in Docker runs.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​DockerRegistryTests.cs Applies Docker daemon resource lock and isolates the registry container name per run.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​CreateNewImageTests.cs Applies Docker daemon resource lock and isolates repository names per run for Docker-backed scenarios.
test/​Microsoft.NET.Build.Containers.IntegrationTests/​CreateImageIndexTests.cs Applies Docker daemon resource lock and isolates repository names per run.

@Evangelink
Evangelink merged commit 713340b into main Sep 9, 2026
26 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/container-parallel-tests branch September 9, 2026 19:46
@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 — f0edffc3 Deployed Sep 9, 2026 by Evangelink via pre_activation #3814
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