Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16320Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16320" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors resource-name-to-instance-id resolution into shared helper methods within AuxiliaryBackchannelRpcTarget and expands the backchannel tests to use consistent timeouts and cover additional log-filtering scenarios (including replica vs unrelated resources).
Changes:
- Extract
ResolveResourceIds/ResolveAllResourceIdsfromGetResourceLogsAsyncand reuse inWaitForResourceAsync’s “resource exists” pre-check. - Update
GetResourceLogsAsyncto use the new helpers and add extra replica/unrelated-resource assertions in tests. - Standardize test awaits to use
DefaultTimeout().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Aspire.Hosting/Backchannel/AuxiliaryBackchannelRpcTarget.cs | Introduces shared resource-id resolution helpers and applies them to log streaming and the wait pre-check. |
| tests/Aspire.Hosting.Tests/Backchannel/AuxiliaryBackchannelRpcTargetTests.cs | Replaces ad-hoc waits with DefaultTimeout() and adds stronger log filtering/negative-case assertions. |
… matching - Extract ResolveResourceIds/ResolveAllResourceIds from GetResourceLogsAsync - Fix WaitForResourceAsync to accept resolved instance names (e.g. apiservice-abc123) - Add DefaultTimeout to all await calls in AuxiliaryBackchannelRpcTargetTests - Add test coverage: verify logs from other resources are excluded, bad instance IDs return empty
- Add ResolveLogicalResourceName to map instance names back to Resource.Name - Fix WaitForResourceAsync to pass logical name to ResourceNotificationService - Add tests: logical name, not-found, resolved instance name, bad instance name
a7210bf to
358b5c0
Compare
davidfowl
approved these changes
Apr 20, 2026
Contributor
|
🎬 CLI E2E Test Recordings — 72 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24649525047 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Cleans up
AuxiliaryBackchannelRpcTargetand improves its test coverage.Use
GetRequiredServiceforDistributedApplicationModelDistributedApplicationModelis always registered by the hosting infrastructure. Several methods usedGetServicewith defensive null checks that silently degraded behavior (e.g., returning empty results or falling back to unresolved names). Replaced allGetService<DistributedApplicationModel>()calls withGetRequiredService<DistributedApplicationModel>()and removed the dead null-handling code in:ResolveWaitTarget— removed null fallback that returned an unresolvedWaitResourceTargetResolveDisplayName— changed parameter fromDistributedApplicationModel?toDistributedApplicationModel, removed null guardGetResourceSnapshotsAsync— removed early empty returnCallResourceMcpToolAsync— removed manual null check +InvalidOperationExceptionExtract
ResolveResourceIdsandResolveAllResourceIdshelpersExtracted the inline resource-name resolution logic from
GetResourceLogsAsyncinto two reusableprivate staticmethods:ResolveResourceIds(appModel, resourceName)— resolves a logical name or instance name to matching resource IDsResolveAllResourceIds(appModel)— returns all resolved resource IDsImprove test coverage
GetResourceSnapshotsAsync_ReturnsEmptyList_WhenAppModelIsNull(no longer applicable)DefaultTimeout()to allawaitcalls across all testsWaitForResourceAsync_ReturnsNotFound_WhenResourceDoesNotExist— verifies not-found for unknown resourceWaitForResourceAsync_ReturnsNotFound_ForBadInstanceName— verifies not-found for a non-existent instance nameGetResourceLogsAsync_ReturnsLogsFromReplicasto verify logs from unrelated resources are excludedGetResourceLogsAsync_ReturnsLogsForSingleReplica_WhenResolvedInstanceNameIsPassedto verify bad instance names return empty resultsFixes #16246
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: