Fix cryptic curl error in CLI E2E AspireStartAsync when dashboard URL is empty#16061
Fix cryptic curl error in CLI E2E AspireStartAsync when dashboard URL is empty#16061
Conversation
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750205bd-83b5-4cca-bfe1-65c59cd74ca8 Co-authored-by: radical <1472+radical@users.noreply.github.com>
When $DASHBOARD_URL extraction from aspire start JSON output fails, the curl call receives an empty string and produces a cryptic error: curl: (3) URL rejected: Malformed input to a URL function This change detects the empty URL via the existing "dashboard-url-empty" echo and throws a clear InvalidOperationException with diagnostic guidance, instead of falling through to the curl call. Fixes the failure pattern seen in: https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300 Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750205bd-83b5-4cca-bfe1-65c59cd74ca8 Co-authored-by: radical <1472+radical@users.noreply.github.com>
|
/create-issue --test "Aspire.Cli.EndToEnd.Tests.PythonReactTemplateTests.CreateAndRunPythonReactProject" --url https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300?pr=16059 |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16061Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16061" |
There was a problem hiding this comment.
Pull request overview
This PR improves failure diagnostics in the CLI E2E test harness by turning an empty dashboard URL (caused by failed JSON extraction) into a clear, actionable exception instead of a cryptic curl error.
Changes:
- Detects the
dashboard-url-emptymarker and throws a clearInvalidOperationExceptionbefore attempting thecurlverification. - Updates the empty-dashboard-URL guard comment to reflect the new fail-fast behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs | Adds fail-fast detection for empty dashboard URL extraction to avoid cryptic curl failures. |
| tests/Aspire.Cli.EndToEnd.Tests/PythonReactTemplateTests.cs | No functional change (whitespace). |
| if (emptySearcher.Search(snapshot).Count > 0) | ||
| { | ||
| dashboardUrlEmpty = true; | ||
| return true; |
There was a problem hiding this comment.
The WaitUntilAsync predicate returns immediately when it sees the dashboard-url-empty marker (before the shell returns to the next prompt). Since the marker is echoed at the start of the if block, this can throw while the rest of the diagnostic cat/ls/tail output is still being produced, so the terminal recording may not contain the logs that the exception message asks the reader to check. Consider setting dashboardUrlEmpty = true when the marker is detected, but continue waiting until the prompt appears (or explicitly wait for the prompt after detecting the marker) before throwing.
| return true; |
Description
Fixes the cryptic
curl: (3) URL rejected: Malformed input to a URL functionerror in CLI E2E tests by detecting an empty dashboard URL early and throwing a clearInvalidOperationExceptionbefore thecurlcall.Problem
The
AspireStartAsynchelper in CLI E2E tests extracts the dashboard URL fromaspire start --format jsonoutput usingsed. When the extraction fails (thedashboardUrlfield is missing or in an unexpected format),$DASHBOARD_URLis empty. The existing code has anif [ -z "$DASHBOARD_URL" ]guard that dumps diagnostic logs when the URL is empty, but then falls through to thecurlcall with the empty URL, producing the cryptic error:This pattern was seen in: https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300?pr=16059
Fix
Instead of falling through to curl after detecting the empty URL, the code now:
dashboard-url-emptyecho marker in the terminal output (from the existing empty-URL guard)InvalidOperationExceptionwith a clear message explaining that the dashboard URL extraction failedcurlverification if the URL was successfully extractedThis makes failures due to empty dashboard URLs produce clear, actionable error messages instead of the cryptic curl error, making diagnosis much easier.
Validation
Fixes #16062
Checklist