Skip to content

Use supported Cosmos emulator API in consumers - #19837

Open
Mitch Denny (mitchdenny) wants to merge 1 commit into
mainfrom
mitchdenny-cosmos-emulator-fix
Open

Use supported Cosmos emulator API in consumers#19837
Mitch Denny (mitchdenny) wants to merge 1 commit into
mainfrom
mitchdenny-cosmos-emulator-fix

Conversation

@mitchdenny

Copy link
Copy Markdown
Member

Description

Main CI and deployment end-to-end builds are blocked because warnings are treated as errors and two consumers still call the obsolete RunAsPreviewEmulator API.

This replaces those calls with the supported RunAsEmulator API 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-restore
  • MSBUILDTERMINALLOGGER=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

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 1, 2026 09:01
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19837

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19837"
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Tests selector

3 / 99 PR test projects · 0 PR jobs · 0 advisory-only targets, from 2 changed files.

Selected PR test projects (3 / 99)

Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests, Aspire.Playground.Tests

Selected PR jobs (0)

none

Advisory workflow impact (0)

none


How these were chosen — grouped by what changed

🧪 tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs (changed test)
1 directly: Aspire.Hosting.Azure.Tests
1 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests

📄 playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/AppHost.cs (changed)
1 directly: Aspire.Playground.Tests

Job reasons

none


Selection computed for commit b8bbbbd.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

Review tier: Balanced
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity 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 RunAsEmulator in 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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages

3 participants