Use supported Cosmos emulator API in consumers - #19837
Use supported Cosmos emulator API in consumers#19837Mitch Denny (mitchdenny) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <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 -- 19837Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19837" |
Tests selector3 / 99 PR test projects · 0 PR jobs · 0 advisory-only targets, from 2 changed files. Selected PR test projects (3 / 99)
Selected PR jobs (0)none Advisory workflow impact (0)none How these were chosen — grouped by what changed🧪 📄 Job reasonsnone Selection computed for commit |
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs — This test now exercises RunAsEmulator, but its name still identifies the obsolete… |
What changed in this PR
Replaces obsolete Cosmos emulator API usage in active consumers.
Changes:
- Uses
RunAsEmulatorin the Azure hosting test and Cosmos playground. - Preserves the explicit obsolete-API compatibility test.
| File | Description |
|---|---|
tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs |
Updates emulator test usage. |
playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/AppHost.cs |
Updates the playground AppHost API call. |
| using var builder = TestDistributedApplicationBuilder.Create(); | ||
| var cosmos = builder.AddAzureCosmosDB("cosmos") | ||
| .RunAsPreviewEmulator(); | ||
| .RunAsEmulator(); |

Description
Main CI and deployment end-to-end builds are blocked because warnings are treated as errors and two consumers still call the obsolete
RunAsPreviewEmulatorAPI.This replaces those calls with the supported
RunAsEmulatorAPI in the Azure Cosmos hosting test and the Cosmos end-to-end playground AppHost. The intentional obsolete-API compatibility test remains unchanged.Validation:
MSBUILDTERMINALLOGGER=false dotnet build playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/CosmosEndToEnd.AppHost.csproj --no-restoreMSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj --no-launch-profile -- --filter-method "*.RunAsPreviewEmulatorAppliesOtlpExporterAnnotation" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?