Repository navigation
Parallelize container integration tests - #56033
Conversation
Co-authored-by: Copilot App <[email protected]>
|
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
Local before/after benchmarkNo local gain in this run on my Windows machine using the SDK repo test runner.
Comparable clean total: 13.974s before -> 15.519s after (-1.545s saved, -11.1%).
Single local run; timings can vary with machine load, but this gives a direct before/after signal on this machine. |
|
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. |
There was a problem hiding this comment.
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. |
Summary
This replacement split carries only the
containersslice 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
DockerDaemonresource lock.LayerEndToEndTestsremains serialized because product code reads the process-wideContentStore.ArtifactRootstate 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.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
ParseContainerPropertiesTestsandTargetsTests: concurrentProjectInstance.Buildcalls failed with “a build is already in progress.” Commitf0edffc32aa72f566ffef5efe3dc8880f351b330adds a narrow sharedMSBuildBuildManagerresource 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.1on Linux (exit 7).