Skip to content

Improve automated test run speed for Aspire-enabled Boilerplate projects (#12332)#12334

Merged
yasmoradi merged 1 commit into
developfrom
12332
May 16, 2026
Merged

Improve automated test run speed for Aspire-enabled Boilerplate projects (#12332)#12334
yasmoradi merged 1 commit into
developfrom
12332

Conversation

@yasmoradi
Copy link
Copy Markdown
Member

@yasmoradi yasmoradi commented May 16, 2026

closes #12332

Summary

When running dotnet test on an Aspire-enabled Boilerplate project, the AppHost starts all resources defined — including admin UIs, dev tunnels, telemetry listeners, and MAUI device emulators. These add significant startup time without providing any value during automated tests.

This PR updates TestsAssemblyInitializer.cs to remove the following unnecessary resources before building and starting the Aspire app:

  • DevTunnelResource / DevTunnelPortResource
  • Database admin UIs: DbGateContainerResource (SqlServer), PgAdminContainerResource (PostgreSQL), PhpMyAdminContainerResource (MySQL), SqliteWebResource (Sqlite)
  • Redis UI tools: RedisInsightResource, RedisCommanderResource
  • MAUI device resources: MauiAndroidDeviceResource, MauiAndroidEmulatorResource
  • OTLP loopback resource

Only essential infrastructure (databases, Redis, etc.) runs during tests, reducing startup time considerably.

Summary by CodeRabbit

  • Chores
    • Optimized test infrastructure by streamlining Aspire test host setup to remove unnecessary resources during testing, improving test reliability and performance.

Review Change Stack

… test (#12332)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a9de2588-b3ea-4b6c-9860-b7a147dbca6d

📥 Commits

Reviewing files that changed from the base of the PR and between 8ed4bdb and ab1e26a.

📒 Files selected for processing (1)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Tests/Infrastructure/TestsAssemblyInitializer.cs

Walkthrough

File header updated with a build directive. The RunAspireHost method refactored to remove a comprehensive set of unnecessary Aspire resources before starting the test host, including dev tunnels, database UIs, Redis tools, MAUI device resources, and OTLP loopback listeners. Builder variable renamed and project-resource removal expanded. Connection-string wiring now uses the filtered resource set.

Changes

Aspire Test Host Setup

Layer / File(s) Summary
Aspire host resource cleanup and build directive
src/Templates/Boilerplate/Bit.Boilerplate/src/Tests/Infrastructure/TestsAssemblyInitializer.cs
File header updated with //+:cnd:noEmit. RunAspireHost method refactored to filter and remove unnecessary resources (dev tunnels, database admin UIs like PgAdmin and PhpMyAdmin, Redis UI tools, MAUI device/emulator resources, and OTLP loopback). Builder variable renamed to aspireAppBuilder, project-resource removal condition broadened to include IResourceWithParent<ProjectResource>, and connection-string environment setup updated to iterate over the cleaned resource set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A cleanup sweep, so neat and clean,
Aspire resources we don't need—removed!
Dev tunnels gone, no UIs in the scene,
Test speeds quickened, no more snoozed.
Leaner tests now take their flight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: improving test run speed by removing unnecessary Aspire resources, which matches the core objective.
Linked Issues check ✅ Passed The code changes implement all requirements from #12332: removing unnecessary Aspire resources (DevTunnel, admin UIs, Redis tools, MAUI devices, OTLP loopback) before building the app.
Out of Scope Changes check ✅ Passed All changes are scoped to the required file and functionality; the refactoring of resource removal logic and builder variable renaming are direct implementations of the stated objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 12332

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yasmoradi yasmoradi merged commit aa89337 into develop May 16, 2026
7 checks passed
@yasmoradi yasmoradi deleted the 12332 branch May 16, 2026 10:48
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.

Improve automated test run speed for Aspire-enabled Boilerplate projects by removing unnecessary resources

1 participant