Repository navigation
Parallelize TemplateEngine tests - #56032
Evangelink merged 1 commit into
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. |
|
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
🔵 Needs a closer look
Review tier: Lite
Findings: None
What changed in this PR
This PR opts TemplateEngine-area test projects into MSTest parallel execution by overriding the repo-wide default of MSTestParallelizeScope=None, selecting ClassLevel or MethodLevel per assembly to balance speed with isolation. It also updates an integration test fixture to better isolate cleanup and culture state when running concurrently.
Changes:
- Enabled MSTest parallelization (per-project override) across multiple TemplateEngine test projects, using
ClassLevelorMethodLevelas appropriate. - Updated
ExportCommandFailureTeststo restore original cultures during cleanup (and use a per-instance temp working directory).
| File | Description |
|---|---|
| test/TemplateEngine/Microsoft.TemplateSearch.TemplateDiscovery.IntegrationTests/Microsoft.TemplateSearch.TemplateDiscovery.IntegrationTests.csproj | Opts the integration test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateSearch.Common.UnitTests/Microsoft.TemplateSearch.Common.UnitTests.csproj | Opts the unit test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Utils.UnitTests/Microsoft.TemplateEngine.Utils.UnitTests.csproj | Opts the unit test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.TemplateLocalizer.Core.UnitTests/Microsoft.TemplateEngine.TemplateLocalizer.Core.UnitTests.csproj | Opts the unit test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Edge.UnitTests/Microsoft.TemplateEngine.Edge.UnitTests.csproj | Opts the unit test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.TemplateVerifier.UnitTests/Microsoft.TemplateEngine.Authoring.TemplateVerifier.UnitTests.csproj | Opts the unit test assembly into MethodLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.TemplateVerifier.IntegrationTests/Microsoft.TemplateEngine.Authoring.TemplateVerifier.IntegrationTests.csproj | Opts the integration test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.Templates.IntegrationTests/Microsoft.TemplateEngine.Authoring.Templates.IntegrationTests.csproj | Opts the integration test assembly into MethodLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests/Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests.csproj | Opts the integration test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.CLI.UnitTests/Microsoft.TemplateEngine.Authoring.CLI.UnitTests.csproj | Opts the unit test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests.csproj | Opts the integration test assembly into ClassLevel parallelization. |
| test/TemplateEngine/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ExportCommandFailureTests.cs | Restores cultures during cleanup to reduce cross-test leakage under parallel execution. |
Suppressed comments (1)
test/TemplateEngine/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ExportCommandFailureTests.cs:29
- Culture is set to invariant in the constructor and only restored in Dispose. If any later constructor step (e.g., Directory.CreateDirectory) throws, Dispose won't run and the test host can keep the invariant culture for subsequent tests on the same thread/execution context.
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
_workingDirectory = Path.Combine(Path.GetTempPath(), "Microsoft.TemplateEngine.TemplateLocalizer.IntegrationTests", Path.GetRandomFileName());
Directory.CreateDirectory(_workingDirectory);
Local before/after benchmarkPartial local gain confirmed on my Windows machine using the SDK repo test runner.
Comparable clean total: 1m 28.2s before -> 1m 01.0s after (27.205s saved, 30.9%).
Single local run; timings can vary with machine load, but this gives a direct before/after signal on this machine. |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. |
Summary
ClassLevelwhere methods share class-scoped state andMethodLevelwhere methods are independently isolated.This is the independent replacement for the
templatesslice of #56015, extracted as 12 files from source84e283b69ce8f087114b5adba1016c8ce1f0e5d0onto base198ec8f3f13efc148f464688a6523341f856e03c.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 short TemplateEngine project medians generally regressed by 2–13 seconds under the complete benchmark; the aggregate fleet still improved because savings in long-running projects dominated. The largest TemplateEngine median regressions were Authoring Tasks integration (+13.324s) and TemplateVerifier integration (+11.384s).