Skip to content

Enable method-level parallelism for TemplateEngine CLI tests - #55631

Merged
Evangelink merged 2 commits into
dotnet:mainfrom
Evangelink:resource-lock-template-tests
Aug 7, 2026
Merged

Enable method-level parallelism for TemplateEngine CLI tests#55631
Evangelink merged 2 commits into
dotnet:mainfrom
Evangelink:resource-lock-template-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • opt Microsoft.TemplateEngine.Cli.UnitTests into MSTest method-level parallelization
  • replace broad serialization of AddJsonPropertyPostActionTests with a named ResourceLock
  • restore the process-global Reporter.Error value after each test

Validation

  • built Microsoft.TemplateEngine.Cli.UnitTests
  • ran the full test application with 32 method-level workers: 776 passed, 6 skipped, 0 failed

Use a resource lock for the process-global Reporter and restore its previous value after each test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9db673a8-46cf-472d-8ba3-d4fc22d8dc16
Copilot AI review requested due to automatic review settings August 6, 2026 09:12
@Evangelink
Evangelink requested a review from a team as a code owner August 6, 2026 09:12
@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.

Pull request overview

This PR enables method-level MSTest parallel execution for Microsoft.TemplateEngine.Cli.UnitTests and adjusts a known non-parallel-safe test class to avoid cross-test interference by serializing access to a process-global Reporter and restoring its original state after each test.

Changes:

  • Enabled MSTest method-level parallelization for Microsoft.TemplateEngine.Cli.UnitTests.
  • Replaced broad serialization with a targeted [ResourceLock] for AddJsonPropertyPostActionTests.
  • Restored Reporter.Error after each test to avoid leaking global state between tests.
Show a summary per file
File Description
test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/AddJsonPropertyPostActionTests.cs Serializes tests that mutate Reporter and restores Reporter.Error after each test run.
test/Microsoft.TemplateEngine.Cli.UnitTests/Microsoft.TemplateEngine.Cli.UnitTests.csproj Opts this test project into MSTest method-level parallelization.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9db673a8-46cf-472d-8ba3-d4fc22d8dc16
@Evangelink
Evangelink merged commit eb9dd9e into dotnet:main Aug 7, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants