Skip to content

ci: enable parallel integration test execution#3506

Merged
tippmar-nr merged 11 commits intomainfrom
ci/parallel-integration-tests
Mar 27, 2026
Merged

ci: enable parallel integration test execution#3506
tippmar-nr merged 11 commits intomainfrom
ci/parallel-integration-tests

Conversation

@tippmar-nr
Copy link
Copy Markdown
Member

@tippmar-nr tippmar-nr commented Mar 25, 2026

This PR enables parallel xUnit test execution (within a single namespace) for the integration and unbounded tests.

The lynchpin to making this work is pre-publishing the .NET Core test apps so that test execution just copies the output instead of running dotnet publish on every app. (.NET framework test apps are already built by MSBuild and didn't need any updates).

Summary

  • Re-enable xUnit parallelization for integration tests, with a workflow input (default: enabled) that can be used to disable parallelization if needed.

  • Disable parallelization for certain namespaces with shared external resource contention: AzureFunction, MsSql, NServiceBus, NServiceBus5 - those will be revisited in a future PR to refactor the tests to enable parallelism where possible.

  • Pre-publish .NET Core test apps in CI build jobs so fixtures copy pre-built output instead of running dotnet publish at runtime, eliminating file-lock collisions on shared obj/ directories

  • Clean up intermediate runtime id-specific build artifacts after pre-publish to keep artifact size manageable

  • Exclude Azure Function apps from pre-publish (func.exe requires framework-dependent build output, not runtime id-specific publish output)

  • Add DotnetTool install lock to prevent concurrent NuGet cache contention (Lambda tests)

tippmar-nr and others added 11 commits March 25, 2026 11:13
… apps

Pre-publish all .NET Core test apps in the CI build jobs so test
fixtures can copy pre-built output instead of invoking dotnet publish
at runtime. This eliminates file-lock collisions on shared dependency
obj/ directories (e.g., ApplicationLifecycle.dll) when multiple
fixtures publish in parallel.

Changes:
- RemoteService.cs: Add TryCopyPrebuiltPublishOutput() that copies from
  pre-published bin/Release/{TFM}/{RID}/publish/ when
  NR_DOTNET_TEST_PREBUILT_APPS=1 is set, falling back to dotnet publish
- all_solutions.yml: Add pre-publish step in both build jobs, set env
  var in both run jobs, replace hard-coded parallelization disable with
  workflow input (default: enabled)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Filter to projects with <OutputType>Exe</OutputType> (skip libraries)
- Drop --no-restore (RID-specific publish needs its own restore)
- Suppress dotnet error output to prevent ##[error] annotations from
  failing the step on non-fatal publish failures
- Add success/failure counters for visibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ng Exe

ASP.NET Core web apps don't have explicit <OutputType>Exe</OutputType>
(the Web SDK infers it), so the previous filter skipped them. Now we
skip only explicit <OutputType>Library</OutputType> projects, catching
web apps and console apps alike.

Also: show error lines on failure instead of suppressing all output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…NServiceBus5

- DotnetTool.cs: Add static lock per package name to serialize concurrent
  dotnet tool install calls that race on the shared NuGet package cache
- all_solutions.yml: Disable parallelization for MsSql and NServiceBus5
  unbounded tests which use shared external infrastructure with hard-coded
  object names (e.g., NewRelic.dbo.TeamMembers, MSMQ queues)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Azure Functions Core Tools (func.exe) crashes (exit code -1) when
multiple instances launch simultaneously, likely due to shared state
in the storage emulator or lock files. Each failure then waits 180s
for an agent log that never appears, cascading into ~15min of wasted
time. Disable parallelism for this namespace until the contention is
resolved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dotnet publish --runtime win-x64 creates large intermediate files in
bin/Release/{TFM}/win-x64/ alongside the publish/ subdirectory. Only
the publish/ output is needed at test runtime. Delete the intermediate
files before archiving to significantly reduce artifact size.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
func.exe start --no-build expects framework-dependent build output,
not RID-specific publish output (missing local.settings.json, different
runtimes/ structure). Azure Function tests already run serially so
runtime dotnet publish won't cause contention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add --no-self-contained to dotnet publish in both the CI pre-publish
step and the runtime fallback in RemoteService.PublishWithDotnetExe.
Framework-dependent publish is ~5MB vs ~60MB per app since it doesn't
bundle the .NET runtime. CI runners have .NET 8 and 10 installed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.80%. Comparing base (d63e16a) to head (ff53c6f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3506   +/-   ##
=======================================
  Coverage   81.79%   81.80%           
=======================================
  Files         508      508           
  Lines       34220    34220           
  Branches     4040     4040           
=======================================
+ Hits        27990    27993    +3     
+ Misses       5265     5261    -4     
- Partials      965      966    +1     
Flag Coverage Δ
Agent 82.79% <ø> (+<0.01%) ⬆️
Profiler 71.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tippmar-nr tippmar-nr marked this pull request as ready for review March 26, 2026 14:31
@tippmar-nr tippmar-nr requested a review from a team as a code owner March 26, 2026 14:31
Copy link
Copy Markdown
Member

@nr-ahemsath nr-ahemsath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The changes to pre-publish .NET Core apps are worth integrating even if we end up disabling parallel execution (which is as easy as changing the default value of the new input).

@tippmar-nr tippmar-nr merged commit 3870228 into main Mar 27, 2026
124 of 135 checks passed
@tippmar-nr tippmar-nr deleted the ci/parallel-integration-tests branch March 27, 2026 15:41
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.

4 participants