[release/13.4] Fix DistributedApplicationTestingBuilder dashboard with dynamic ports#17731
Conversation
…ed with dynamic ports When users set DisableDashboard = false on DistributedApplicationTestingBuilder, the TransportOptionsValidator rejected the HTTP URLs that the testing builder defaults (http://localhost:8080, http://localhost:4317) because ASPIRE_ALLOW_UNSECURED_TRANSPORT was not set. Fix: Set AllowUnsecuredTransport = true by default in PreConfigureBuilderOptions, since all URLs are already defaulted to HTTP. Add a regression test that enables the dashboard and verifies it becomes healthy. Fixes #17622
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17731Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17731" |
|
❓ CLI E2E Tests unknown — 110 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26687044927 |
|
Failures are unrelated. Merging. |
|
✅ No documentation update needed. docs_optional → bug_fix_restores_documented_behavior No signals triggered (signal_count = 0). This PR is a backport of #17729 to Changed files:
The PR body explicitly states: "this is a regression from 13.3 introduced by #16046 in 13.4. The fix restores the ability to use |
Backport of #17729 to release/13.4
/cc @JamesNK
Customer Impact
Users of
DistributedApplicationTestingBuilderwho enable the dashboard (explicitly viaDisableDashboard = falseor in future when it becomes the default) hit two failures introduced by #16046:ListenLocalhost(0)throws "Dynamic port binding is not supported when binding to localhost."OptionsValidationExceptionbecause the dashboard URLs default to HTTP butTransportOptionsValidatorrejects HTTP withoutASPIRE_ALLOW_UNSECURED_TRANSPORTset to true.This blocks any testing scenario that uses the dashboard with dynamic ports, which is the standard configuration path.
Reported in #17622.
Testing
DashboardEnabledInTestingBuilderShouldWorkWithDynamicPortsverifies dashboard starts with default dynamic port configuration.LoopbackWithDynamicPortsverifies explicit127.0.0.1:0and[::1]:0endpoints work.NonLocalResourceServiceEndpointThrowsverifies non-local addresses are rejected.IsLocalResourceServiceEndpoint_ReturnsExpectedResultremoved (method no longer exists).Risk
Low. The changes are scoped to the testing builder and dashboard service host startup path:
AllowUnsecuredTransport = trueonly applies in testing scenarios (matches the HTTP default already set for dashboard URLs).Listen(IPAddress, port)instead ofListenLocalhost(port)only for parseable loopback IPs, preserving existing behavior forlocalhosthostnames.Regression?
Yes — this is a regression from 13.3 introduced by #16046 in 13.4. The fix restores the ability to use
DistributedApplicationTestingBuilderwith the dashboard enabled on dynamic ports.