Skip to content

Improve Azure hosting test logging and stability - #20249

Merged
James Newton-King (JamesNK) merged 3 commits into
microsoft:mainfrom
JamesNK:fix/azure-test-output-logging
Sep 19, 2026
Merged

James Newton-King (JamesNK) merged 3 commits into
microsoft:mainfrom
JamesNK:fix/azure-test-output-logging

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Description

A configuration-only Azure Service Bus emulator test intermittently failed in CI while stopping the distributed application after its assertions had already passed. These tests only inspect generated emulator configuration and do not need to start containers.

This change:

  • Removes unnecessary application startup, shutdown, and container-runtime requirements from the Service Bus and Event Hubs emulator configuration tests.
  • Explicitly passes ITestOutputHelper to every TestDistributedApplicationBuilder created by Aspire.Hosting.Azure.Tests, ensuring hosting and resource logs are available in test output.
  • Routes logs from builders created inside RemoteExecutor child processes through redirected console output to the parent test output helper, and drains redirected output before completion.

Validation:

  • dotnet build tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj --no-restore /p:SkipNativeBuild=true
  • Seven Service Bus and Event Hubs emulator configuration tests pass.
  • AzurePublishingContext_WithBicepTemplateFile_WorksWithRelativePath passes and verifies that the final child-process log reaches the parent test output.

Fixes #20224
Fixes #20227
Related to #7066

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

@github-actions

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 -- 20249

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20249"

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

🟡 Changes recommended

The remote-process helper silently returns on timeout, allowing incomplete output checks and a second timeout wait during disposal.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Improves Azure hosting test diagnostics and stability by avoiding unnecessary emulator startup and consistently capturing builder and child-process logs.

Changes:

  • Routes Azure test builder logs through ITestOutputHelper.
  • Converts emulator configuration checks to configuration-only tests.
  • Redirects and drains RemoteExecutor output.
File Description
tests/​Aspire.Hosting.TestUtilities/​Utils/​TestDistributedApplicationBuilder.cs Adds output-aware builder overloads.
tests/​Aspire.Hosting.Azure.Tests/​TokenCredentialProviderTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​RoleAssignmentTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​RemoteTestOutputHelper.cs Bridges child-process output to tests.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​WebPubSubPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​SqlPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​SignalRPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​ServiceBusPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​SearchPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​RedisPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​PostgreSQLPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​OperationalInsightsPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​KeyVaultPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​FunctionsPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​EventHubsPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​CosmosDBPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​CognitiveServicesPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​ApplicationInsightsPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​AppContainersPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​PublicApiTests/​AppConfigurationPublicApiTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​FoundryDeploymentConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​FoundryConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​ExistingAzureResourceExtensionsTests.cs Propagates test output through factories.
tests/​Aspire.Hosting.Azure.Tests/​DurableTaskResourceExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​ContainerRegistryTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​BicepUtilitiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureWebPubSubExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureWebPubSubConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureUserAssignedIdentityTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureTableStorageConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureStorageResourceUriExpressionTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureStoragePrivateEndpointLockdownTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureStorageEmulatorFunctionalTests.cs Uses centralized logging setup.
tests/​Aspire.Hosting.Azure.Tests/​AzureStorageConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSqlExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSqlDeploymentScriptTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSqlDatabaseConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSqlConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSignalRExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSignalREmulatorFunctionalTest.cs Uses centralized logging setup.
tests/​Aspire.Hosting.Azure.Tests/​AzureSignalRConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureServiceBusTopicConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureServiceBusSubscriptionConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureServiceBusQueueConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureServiceBusConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSearchExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureSearchConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureRunAsEmulatorModeTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureResourcePreparerTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureResourceOptionsTests.cs Passes output to publish builder.
tests/​Aspire.Hosting.Azure.Tests/​AzureRedisExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureQueueStorageQueueConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureQueueStorageConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureProvisioningResourceTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureProvisioningResourceExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzurePrivateEndpointLockdownTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzurePrivateEndpointExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzurePostgresFlexibleServerDatabaseConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzurePostgresFlexibleServerConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzurePostgresExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureOpenAIExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureOpenAIDeploymentConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureOpenAIConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureNetworkSecurityPerimeterExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureNetworkSecurityGroupExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureNatGatewayExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureManagedRedisExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureManagedRedisConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureLogAnalyticsWorkspaceExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureKustoExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureKeyVaultConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureInfrastructureExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureFrontDoorTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureEventHubsConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureEventHubConsumerGroupConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureEventHubConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureEnvironmentResourceTests.cs Forwards and verifies remote logs.
tests/​Aspire.Hosting.Azure.Tests/​AzureEnvironmentResourceExtensionsTests.cs Enables shared builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureDataLakeStorageResourceGetConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureDataLakeStorageFileSystemConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureCosmosDBDatabaseConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureCosmosDBContainerConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureCosmosDBConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureContainerRegistryTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureContainerAppExpressTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureContainerAppExpressEndpointTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureContainerAppEnvironmentExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureBlobStorageContainerConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureBlobStorageConnectionPropertiesTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureBicepResourceTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureAppServiceEnvironmentExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureApplicationInsightsExtensionsTests.cs Enables builder logging.
tests/​Aspire.Hosting.Azure.Tests/​AzureAppConfigurationExtensionsTests.cs Enables builder logging.

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

🟢 Approval recommended

The configuration-only tests avoid unnecessary runtime startup, and the remote logging path includes focused timeout and output-drain coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@mitchdenny Mitch Denny (mitchdenny) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the logging, remote-process timeout cleanup, and configuration-only test changes. No blocking issues found.

@JamesNK
James Newton-King (JamesNK) merged commit a20c79b into microsoft:main Sep 19, 2026
130 checks passed
@github-actions github-actions Bot added this to the 13.6 milestone Sep 19, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

3 participants