Repository navigation
Fix empty DCP container host name breaking container OTLP endpoint - #21316
David Fowler (davidfowl) wants to merge 1 commit into
Conversation
… name Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21316Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21316" |
Tests selector52 / 100 PR test projects · 4 PR jobs, from 2 changed files. Selected PR test projects (52 / 100)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 46
🧪 📦 affected project 📦 affected project Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
The narrow fallback change preserves non-empty host behavior and includes focused regression coverage, with no unresolved review findings.
No open issues 🎉
What changed in this PR
Fixes container-facing OTLP URL construction when DCP reports an empty host name by using the existing runtime-specific fallback.
Changes:
- Treats empty host names like null while preserving non-empty values.
- Adds regression coverage for Docker and Podman defaults and custom host names.
Tests were not executed locally; validation remains dependent on PR CI.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/Dcp/DcpDependencyCheckTests.cs | Adds focused host-name fallback tests. |
| src/Aspire.Hosting/Dcp/IDcpDependencyCheckService.cs | Applies runtime defaults to empty host names and documents the fallback. |
Review effort: Balanced
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Reviewed the fallback change, container-facing URL consumers, and regression coverage. No issues found. Focused DcpDependencyCheckTests run: 9 passed, 0 failed.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Recurrence evidence: |
|
Closing as superseded: the identical 🤖 Posted by AspireAgent (AI Agent) |
) ## What failed `Aspire.Hosting.Java.Tests.AddJavaContainerTests.AddJavaContainer_ExportsTelemetryToAspire` failed in `Hosting.Java (windows-latest)` on attempt 1 with: ``` System.AggregateException : One or more errors occurred while resolving resource configuration. (Application orchestrator dependency check returned an error: The operation has timed out. ... dcp.info.os-executor Context expired, stopping process... {"Command": "C:\\Windows\\system32\\docker.exe", "Args": ["--version"]} at Aspire.Hosting.Dcp.DcpDependencyCheck.GetDcpInfoAsync(...) at Aspire.Hosting.ApplicationModel.HostUrl...GetValueAsync(...) ``` Runs: [41873115695](https://github.com/microsoft/aspire/actions/runs/41873115695) (main, 11-04) and [42181390567](https://github.com/microsoft/aspire/actions/runs/42181390567) (PR, 11-06). This is rank 5 in the unowned-flakes list on #21600. ## Why The test builds a run-mode app and resolves the container's environment. `OTEL_EXPORTER_OTLP_ENDPOINT` is a `HostUrl`, and in run mode `HostUrl` asks `IDcpDependencyCheckService` for the container host name. The real service runs `dcp info` under the 25s `DcpOptions.DependencyCheckTimeout`. On busy Windows runners, DCP's `docker --version` probe inside `dcp info` sometimes takes longer than that (the shared infra cause tracked in #21771), so the test fails before it reaches its assertion. `WithJvmArgs_AppliesToAContainerToo` in the same class goes through the same path. The test only needs a container host name from DCP. It doesn't need DCP itself. Its old assertion also compared the env var against a second call to that same live service, so it couldn't catch `HostUrl` ignoring the host name DCP reports. ## How it's fixed Test-only change. Both tests register a deterministic `IDcpDependencyCheckService` (the existing `TestDcpDependencyCheckService` from `Aspire.Hosting.TestUtilities`, which now grants `InternalsVisibleTo` to `Aspire.Hosting.Java.Tests` like the Go and Dotnet test projects). `AddJavaContainer_ExportsTelemetryToAspire` now reports `host.wslc.internal` (the runtime-specific case from #21244) and asserts the exact `http://host.wslc.internal:4317`. The test still builds the app and goes through the real `HostUrl` and `DcpOptions` path. No timeouts, retries or assertions were relaxed. **Related:** #21316 (closed without merging) targeted an earlier failure of this same test, a different root cause: DCP reported an empty container host name, which produced `http://:4317`. #21432 fixed that cause on main on 10-30. This PR fixes the remaining `dcp info` timeout signature, which neither PR covers. ## Confidence - **Before** (main `2f471dc6`, `DcpPublisher__CliPath` pointing at a fake `dcp` whose `info` hangs for 60s): **3/3 runs fail**. Both tests fail after about 30s with the same `Application orchestrator dependency check returned an error: The operation has timed out` message as CI. - **After**, same hanging `dcp`: **10/10 runs pass** (14/14 tests, about 1s). - **After**, real DCP 0.27.3 (Linux x64): **20/20 runs pass**. - **Regression check:** if `HostUrl` is changed to ignore DCP's host name (always `host.docker.internal`), the new test fails with `Expected: "http://host.wslc.internal:4317"`, `Actual: "http://host.docker.internal:4317"`. The old assertion would still pass on any runner where DCP reports `host.docker.internal`. - **Main uncertainty:** the underlying Windows `docker --version` slowness isn't fixed here. It can still affect tests that actually start DCP, and #21771 tracks it. **How we stop this recurring:** unit tests that only need a value from DCP (such as the container host name) should register a deterministic `IDcpDependencyCheckService` instead of running the real `dcp info`. ## Failure stats (14d, attempt 1) Source: a scan of every CI (`ci.yml`) run created 10-09 → 11-08 13:00Z, using attempt-1 `Hosting.Java` jobs and their logs. - **Exact test / signature:** `Aspire.Hosting.Java.Tests.AddJavaContainerTests.AddJavaContainer_ExportsTelemetryToAspire` failing with `Application orchestrator dependency check returned an error: The operation has timed out ... docker.exe --version` (Windows). - **Main:** 1/161 runs where the `Hosting.Java` job ran (0.6%). **PR:** 1/471 (0.2%). Including the sibling `WithJvmArgs_AppliesToAContainerToo`, which has the same signature and is fixed here, PR is 2/471 (0.4%). - **Rerun-pass:** 1 of 1 rerun (the other hits were not re-run). - **Last hit:** 11-06 07:31Z. Runs: [42181390567](https://github.com/microsoft/aspire/actions/runs/42181390567) (PR), [42134705233](https://github.com/microsoft/aspire/actions/runs/42134705233) (PR, sibling test), [41873115695](https://github.com/microsoft/aspire/actions/runs/41873115695) (main). - **30d main hits (this signature):** 1/280. The other 30d failures of this test were `Strings differ` (WSLc and empty host name), fixed by #21254 and #21432. None has appeared since #21432 merged on 10-30 15:51Z. One more hit, [41194713391](https://github.com/microsoft/aspire/actions/runs/41194713391) (DCP `CliPath` validation on both OSes), is branch-caused and excluded. - **Local:** before the fix, 0/3 passed with a hanging `dcp info`. After the fix, 10/10 passed with a hanging `dcp info` and 20/20 with real DCP. The mutation check fails as expected. - **PR CI:** CI run [42491774241](https://github.com/microsoft/aspire/actions/runs/42491774241) passed on attempt 1, including `Hosting.Java` on Windows and Ubuntu. - **Verdict: MODERATE.** The hit count is low (3 including the sibling), but one hit is on main, the CI error reproduces exactly in a deterministic local test, and the same probe timeout hits other tests (#21771). ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
AddJavaContainerTests.AddJavaContainer_ExportsTelemetryToAspirefailed on main CI (run 40248143715, Hosting.Java, windows-latest): expectedhttp://:4317, actualhttp://. The expected value shows DCP reported an emptyhostName, soDcpContainersInfo.ContainerHostNamereturned""(HostName ?? ...only handles null) and container-facing OTLP URLs were built with an empty host. EmptyHostNamenow falls back to the runtime default, same as null.Whether DCP reports an empty
hostNameon that runner is inferred from the failure output; I could not confirm it from the logs.Validation:
dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-method "*.ContainerHostName_FallsBackToRuntimeDefaultWhenHostNameIsNullOrEmpty" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"— not run: restore failed in the sandbox (dotnet-public feed download errors, NU1900/NU1905). Unverified locally; relying on PR CI. Windows not run.Fixes # (issue)
Checklist