Add E2E coverage for Entity Framework Core deployment scenarios
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
Entity Framework Core hosting deployment behavior is currently covered primarily by unit tests. `Aspire.Cli.EndToEnd.Tests` and `Aspire.Deployment.EndToEnd.Tests` do not exercise `AddEFMigrations`, `PublishAsMigrationBundle`, or deployment of a generated migration bundle.
`Aspire.Playground.Tests` includes the `SqlServerEndToEnd` AppHost with `AddEFMigrations` and `RunDatabaseUpdateOnStart`, but that test is quarantined and exercises run mode rather than `aspire publish` and deployment. This leaves publish-specific behavior, such as connection string placeholders passed to EF design-time tooling, without E2E coverage. PR #17905 fixes one such regression.
### Describe the solution you'd like
Add an automated E2E deployment scenario that:
1. Creates or uses an Aspire application with an EF Core `DbContext` and database resource.
2. Configures `AddEFMigrations`, a database reference, and `PublishAsMigrationBundle`.
3. Runs the application through the real Aspire CLI publish/deployment path.
4. Verifies migration-bundle generation succeeds while database resources are not yet provisioned.
5. Deploys or runs the generated migration resource with the resolved connection string.
6. Verifies the migration was applied, such as by querying the created schema or exercising an application endpoint backed by the migrated database.
The scenario should cover at least one Azure deployment target and provider used by customers, preferably Azure PostgreSQL or Azure SQL with Container Apps. If full cloud deployment is too costly for regular PR validation, split coverage between a CLI E2E publish test and a scheduled deployment E2E test.
### Additional context
Relevant existing coverage:
- `tests/Aspire.Hosting.EntityFrameworkCore.Tests/` covers the EF hosting model and pipeline behavior with focused tests.
- `playground/SqlServerEndToEnd/` configures EF migration resources in run mode.
- `tests/Aspire.Playground.Tests/AppHostTests.cs` exercises that playground, but the encompassing test is quarantined.
- `tests/Aspire.Deployment.EndToEnd.Tests/VnetSqlServerConnectivityDeploymentTests.cs` validates SQL connectivity but uses the SQL client integration rather than EF Core migrations.
This issue is intended to cover the real CLI publish and deployment boundary where unit tests cannot detect design-time tooling and connection-string resolution regressions.
Contributor guide
Research direction
Start by reading tests/Aspire.Hosting.EntityFrameworkCore.Tests/, playground/SqlServerEndToEnd/, and tests/Aspire.Playground.Tests/AppHostTests.cs to understand the existing EF migration setup. Compare the CLI and deployment patterns in Aspire.Cli.EndToEnd.Tests and Aspire.Deployment.EndToEnd.Tests, including VnetSqlServerConnectivityDeploymentTests. Done means an automated scenario covers publish, migration-bundle generation before database provisioning, deployment, connection-string resolution, and verification that the migration was applied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, sql
- Domain
- cloud, databases, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100