Add E2E deployment test for React + ASP.NET Core to Azure App Service#14326
Add E2E deployment test for React + ASP.NET Core to Azure App Service#14326
Conversation
This adds a new deployment test that: - Creates a project using the Starter App (ASP.NET Core/React) template - Deploys to Azure App Service (instead of Container Apps) - Verifies the deployed endpoints are accessible The test follows the established patterns from AcaStarterDeploymentTests and PythonFastApiDeploymentTests.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14326Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14326" |
|
/deployment-test |
|
🚀 Starting deployment tests on PR #14326... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
There was a problem hiding this comment.
Pull request overview
This PR adds a new end-to-end deployment test that validates deploying a React + ASP.NET Core application to Azure App Service, complementing existing tests for Azure Container Apps deployments.
Changes:
- Adds
AppServiceReactDeploymentTests.cswith a comprehensive E2E test for Azure App Service deployment - Follows established patterns from
AcaStarterDeploymentTestsandPythonFastApiDeploymentTests - Uses the React template with
Aspire.Hosting.Azure.AppServicepackage andAddAzureAppServiceEnvironmentAPI
| "failed=0 && " + | ||
| "for url in $urls; do " + | ||
| "echo -n \"Checking https://$url... \"; " + | ||
| "STATUS=$(curl -s -o /dev/null -w \"%{http_code}\" \"https://$url\" --max-time 30 2>/dev/null); " + |
There was a problem hiding this comment.
The curl timeout is set to 30 seconds here, while the similar tests AcaStarterDeploymentTests.cs (line 229) and PythonFastApiDeploymentTests.cs (line 223) use 10 seconds. If App Service endpoints require more time to respond than Container Apps, this deviation should be explained in a comment. Otherwise, consider using the same 10-second timeout for consistency across the test suite.
| "STATUS=$(curl -s -o /dev/null -w \"%{http_code}\" \"https://$url\" --max-time 30 2>/dev/null); " + | |
| "STATUS=$(curl -s -o /dev/null -w \"%{http_code}\" \"https://$url\" --max-time 10 2>/dev/null); " + |
The React template (aspire-ts-cs-starter) has different prompts than the Blazor starter template: - Does NOT have a 'test project' prompt - Output path prompt includes the default path Updated to match the working JsReactTemplateTests pattern.
|
/deployment-test |
|
🚀 Starting deployment tests on PR #14326... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
❌ Deployment E2E Tests failed One or more deployment tests failed. Check the workflow run for details. 🎬 Terminal Recordings
|
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #21666390803 |
- Increase pipeline wait timeout from 10-20 min to 30 min across all deployment tests - Increase overall test timeout to 40 min to accommodate longer deployments - Fix cleanup workflow to target both e2e-* (current) and rg-aspire-* (legacy) prefixes
Each endpoint is now retried up to 18 times (10 second intervals) for a total of ~3 minutes before failing. This handles cases where deployed apps need time to become responsive after deployment completes.
|
❌ Deployment E2E Tests failed One or more deployment tests failed. Check the workflow run for details. 🎬 Terminal Recordings
|
|
/deployment-test |
|
🚀 Starting deployment tests on PR #14326... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
The NuGet.config prompt behavior is inconsistent in CI - sometimes it appears interactively, sometimes it auto-accepts. Updated tests to: 1. Wait 5 seconds after running aspire init 2. Press Enter (dismisses prompt if present, no-op if auto-accepted) 3. Then wait for 'Aspire initialization complete' This handles both interactive and non-interactive cases.
Azure resources that require role assignments (Storage, KeyVault, AppConfig,
ServiceBus, EventHubs) need a managed identity principal. The Container App
Environment provides this. Updated 5 failing tests to include:
builder.AddAzureContainerAppEnvironment("env")
This provides the principal required for provisioning role assignments.
AddAzureContainerAppEnvironment() requires the ContainerApps hosting package.
Updated 5 tests to add this package before adding the specific Azure resource
package. Flow is now:
1. aspire init
2. aspire add Aspire.Hosting.Azure.ContainerApps
3. aspire add Aspire.Hosting.Azure.{Resource}
4. modify apphost.cs to use AddAzureContainerAppEnvironment + AddAzure{Resource}
Add pattern searcher for 'Select an integration to add:' prompt and wait for it before pressing Enter to select the first match. This handles the fuzzy matching that shows multiple options.
aspire add may show either: - Integration selection prompt if multiple matches - Version selection prompt if unique match The combined searcher waits for either prompt type.
aspire add Aspire.Hosting.Azure.ContainerApps triggers: 1. Integration selection prompt (matches multiple Azure packages) 2. Version selection prompt (in CI) Need to wait for and handle both prompts sequentially.
- Use discard pattern (_) instead of unused variable for AddAzureContainerAppEnvironment - Update README.md Test Structure section to include new Azure resource test files
App Service provisioning takes longer than 30 minutes, causing test timeouts. Skipped until infrastructure issues are resolved.
Summary
This PR adds a new end-to-end deployment test that validates deploying a React + ASP.NET Core application to Azure App Service.
What's new
AppServiceReactDeploymentTests.csTest details
The test follows the established patterns from
AcaStarterDeploymentTestsandPythonFastApiDeploymentTests:aspire newwith the React templateAspire.Hosting.Azure.AppServicepackageAppHost.csto useAddAzureAppServiceEnvironment("infra")aspire deployaz webapp listKey differences from Container Apps tests
Aspire.Hosting.Azure.AppContainersAspire.Hosting.Azure.AppServiceAddAzureContainerAppEnvironmentAddAzureAppServiceEnvironmentaz containerapp listaz webapp listTesting
The
deploy-test/*branch pattern will automatically trigger the deployment workflow to validate this test.