Add persistent container test coverage - #17871
Merged
David Negstad (danegsta) merged 15 commits intoJun 3, 2026
Merged
Conversation
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
David Negstad (danegsta)
June 3, 2026 15:54
View session
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17871Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17871" |
Use an isolated user-secrets store for persistent container test runs so integration defaults can persist generated parameters across AppHost restarts. Avoid the CI container registry override for Azurite because the mirrored tag is unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Let persistent container tests use the same container registry configuration path as normal TestDistributedApplicationBuilder usage instead of forcing the test mirror from the helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
David Negstad (danegsta)
marked this pull request as ready for review
June 3, 2026 17:32
David Negstad (danegsta)
requested a review
from Mitch Denny (mitchdenny)
as a code owner
June 3, 2026 17:32
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automated coverage to validate “persistent lifetime” behavior for container-backed resources across AppHost restarts, plus targeted Azure emulator mode assertions, and a CLI end-to-end persistence scenario.
Changes:
- Introduces a shared test helper to assert persistent resources reuse the same underlying container across AppHost runs.
- Adds per-integration functional tests covering persistent lifetime container reuse (Redis/Postgres/etc.) and Azure Storage emulator persistence.
- Adds Azure
RunAsEmulatorrun-vs-publish mode tests and a CLI E2E test that verifies data persists across restarts.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Valkey.Tests/ValkeyFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Valkey. |
| tests/Aspire.Hosting.Tests/Utils/TestDistributedApplicationBuilder.cs | Extends helper to accept args when creating builders with the test container registry override. |
| tests/Aspire.Hosting.Tests/Utils/PersistentContainerTestHelpers.cs | New shared helper for asserting persistent container reuse across AppHost runs. |
| tests/Aspire.Hosting.SqlServer.Tests/SqlServerFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for SQL Server. |
| tests/Aspire.Hosting.Seq.Tests/SeqFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Seq. |
| tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Redis. |
| tests/Aspire.Hosting.RabbitMQ.Tests/RabbitMQFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for RabbitMQ. |
| tests/Aspire.Hosting.Qdrant.Tests/QdrantFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Qdrant. |
| tests/Aspire.Hosting.PostgreSQL.Tests/PostgresFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for PostgreSQL. |
| tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Oracle. |
| tests/Aspire.Hosting.Nats.Tests/NatsFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for NATS. |
| tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for MySQL. |
| tests/Aspire.Hosting.MongoDB.Tests/MongoDbFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for MongoDB. |
| tests/Aspire.Hosting.Milvus.Tests/MilvusFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Milvus. |
| tests/Aspire.Hosting.Kafka.Tests/KafkaFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Kafka. |
| tests/Aspire.Hosting.Garnet.Tests/GarnetFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Garnet. |
| tests/Aspire.Hosting.Azure.Tests/AzureStorageEmulatorFunctionalTests.cs | Adds persistent-lifetime container reuse functional test for Azure Storage emulator. |
| tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs | New tests validating RunAsEmulator behavior differs correctly between run and publish modes. |
| tests/Aspire.Cli.EndToEnd.Tests/PersistentContainerEndToEndTests.cs | New CLI E2E validating Redis/Postgres/Azurite data persists across aspire start/stop cycles. |
Avoid blocking the test server on dependency health checks in the CLI E2E scenario. The endpoint verification already retries real Redis, PostgreSQL, and Azure Storage operations after the resources have started. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assert persistent container tests observe container.lifetime=Persistent and compare the actual container.id across AppHost runs instead of the stable DCP resource ID. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
David Negstad (danegsta)
enabled auto-merge (squash)
June 3, 2026 20:03
Contributor
|
❓ CLI E2E Tests unknown — 113 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26907155580 |
Member
|
/backport to release/13.4 |
Contributor
|
Started backporting to |
Karol Zadora-Przylecki (karolz-ms)
approved these changes
Jun 3, 2026
Mitch Denny (mitchdenny)
pushed a commit
to mitchdenny/aspire
that referenced
this pull request
Jun 9, 2026
* Add per-integration persistence tests Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Add CLI persistent container E2E test Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Fix persistence test compilation Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Address persistence test review feedback Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Add Azure emulator mode coverage Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Address emulator mode test review feedback Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Stabilize persistent container tests Use an isolated user-secrets store for persistent container test runs so integration defaults can persist generated parameters across AppHost restarts. Avoid the CI container registry override for Azurite because the mirrored tag is unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Stop forcing test container registry in persistent helper Let persistent container tests use the same container registry configuration path as normal TestDistributedApplicationBuilder usage instead of forcing the test mirror from the helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use start waits in persistent container E2E Avoid blocking the test server on dependency health checks in the CLI E2E scenario. The endpoint verification already retries real Redis, PostgreSQL, and Azure Storage operations after the resources have started. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Compare Docker container IDs in persistent tests Assert persistent container tests observe container.lifetime=Persistent and compare the actual container.id across AppHost runs instead of the stable DCP resource ID. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Read synthetic user secrets in persistent tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Allow persistent tests to opt into test registry Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Make persistent test secrets cleanup best effort Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix persistent container E2E networking Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Propagate CLI E2E start timeout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> Co-authored-by: David Negstad <David.Negstad@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds test coverage for persistent container behavior so the branch can be validated before it is marked ready for review.
This change:
RunAsEmulatormode coverage for run vs. publish behavior.Validation: Not run in this session; opening as draft for validation.
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?