Repository navigation
Add experimental built-in Cargo testing integration - #21587
Mitch Denny (mitchdenny) wants to merge 7 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
39e8792 to
a0a7431
Compare
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21587Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21587" |
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
This comment has been minimized.
This comment has been minimized.
cd5ed10 to
be8ff7b
Compare
be8ff7b to
4a7ef93
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
4a7ef93 to
45e459e
Compare
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
a6c0d17 to
2a229c4
Compare
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
2a229c4 to
7b94df1
Compare
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Keep Cargo launch configuration and guards independent of collection, preserve flat resource artifacts, and cover replacement and cancellation semantics. Co-authored-by: Copilot App <[email protected]>
Distinguish whole-run and resource output paths and verify the renamed generated context getter without changing Cargo execution. Co-authored-by: Copilot App <[email protected]>
Add testCommandEnabled to Rust and combined playground invocations without changing hosting runtime behavior or saved configuration. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
7b94df1 to
af6a2e7
Compare
Tests selector53 / 101 PR test projects · 4 PR jobs, from 14 changed files. Selected PR test projects (53 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 48
📦 affected project 📦 affected project 📄 📄 📄 📄 📄 🔧 🔧 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
…21559) <!-- copilot-assessment:v1 --> ### Agent assessment Self-reported assessment, not an independent review. Assessed revision: `88c7bca539e15ae8d2fd9c2e2903b65919ab7603` | Dimension | Assessment | Rationale | |---|---|---| | Change confidence | 8/10 | ↑ Eight original MSTest patches preserved on main; follow-ups correct replica wording and accurately distinguish collection errors from failing cases.<br>↑ Parent8457d04 passed79 MSTest tests, including real MTP success/failure, two export tests and AppHost build; no executable code changed since.<br>↓ Restart, temporary cleanup and deferred arguments remain explicitly accepted nonblocking follow-ups in #22706, #22707 and #22708; a separate parser-option review finding remains unaddressed.<br>↓ Final-head CI/native validation is pending or running; cross-platform/full CLI behavior was not rerun locally. | <!-- /copilot-assessment --> ## Description Adds the experimental MSTest layer of the Aspire testing stack: `AddMsTest`, `MsTestResource : ExecutableResource`, and `MsTestOptions` in `Aspire.Hosting.Dotnet`. An executable MSTest project composes normal references, environment variables and waits, and publishes individual TRX results during `aspire test`. All new hosting testing APIs are experimental under `ASPIRETESTING001`, with TypeScript export coverage. Foundation #21527 is merged into main at `16f52aeb827e6415fa1e1d318a98dcdad607bcc5`. This PR now targets `main` at that exact revision. Current MSTest head: `88c7bca539e15ae8d2fd9c2e2903b65919ab7603` on `mitchdenny-mstest-testing-integration`. Nov26 documentation follow-ups remove “shared by its replicas” from the MSTest artifact-directory paragraph, addressing José's review, and clarify James's failed-summary finding: a failed TRX run summary causes a collection error only when no individual failing outcome explains it; with failing cases, collection can complete successfully while the overall test outcome fails. Both are precise README-only corrections; no production code, generated API or lifecycle behavior changed. The commits were pushed with explicit observed-tip leases against `8457d04b28670374abc750f30749dff74bcb2fc6` and `382b7f1d3f95c7893eb2aae0c93e936c84ed7177`, respectively. José's and James's documentation threads are resolved after their respective fixes were pushed. Three runtime findings are explicitly nonblocking follow-ups, not fixes in this PR: Restart ordering #22706, temporary-report cleanup #22707, and deferred runner arguments #22708. Each issue links its original James discussion, and each discussion links its issue; those three threads are resolved with the deferral stated explicitly. A separate parser-option syntax review finding remains unaddressed by these documentation/follow-up changes. Nov26 reconciliation: GitHub had already retargeted and rebased this PR after the foundation merge. The verified server head `8457d04b28670374abc750f30749dff74bcb2fc6` contains current main and exactly the eight intended MSTest patches; `git range-diff` confirms each patch is identical to the previous head `cdfe8f543daf1d52b5d51930ce6f7e38ceea73ea`. The owning worktree adopted that verified server head; no additional rebase was necessary. Existing non-draft state and native stack #22374 complete membership [#21527, #21559, #21580, #21585, #21587, #21675], including merged foundation, were preserved. No unstack/recreate, upper propagation, metadata changes, merge or auto-merge. Dashboard #21646 remains closed/removed. Fixes: N/A (feature request; foundation #21527 is merged). ### Usage ```csharp #pragma warning disable ASPIRETESTING001 builder.AddMsTest("api-tests", "../Api.Tests/Api.Tests.csproj") .WithReference(api) .WaitFor(api); ``` ```typescript await builder.addMsTest("api-tests", "../Api.Tests/Api.Tests.csproj") .withReference(api) .waitFor(api); ``` The preview CLI command is disabled by default. Opt in per invocation without changing global configuration: ```bash features__testCommandEnabled=true aspire test ``` The project must enable the MTP executable runner and register `Microsoft.Testing.Extensions.TrxReport`; MSTest.Sdk's Default profile supplies both. Aspire does not change project dependencies or runner configuration. Optional configuration, selected target framework and structured runner argument tokens are supported. Invocation uses `dotnet run --project <absolute.csproj> --no-launch-profile -- ...`. Ordinary runs omit Aspire reporting flags and collection; publish excludes the resource. This initial executable-based integration builds independently of the AddDotnetProject coordinator; shared build outputs can contend. ### Collection and artifacts Uses the foundation's runtime-only `WithTesting(Func<ResourceTestingContext, Task>?)` callback. Repeated calls replace the callback; marker-only clears collection while retaining context. Runner setup is independent of that replaceable callback. Remote callback timeout, connection lifetime, cancellation and invocation-gate release/reentry behavior come from the foundation. During test-mode `OnBeforeStart`, the integration resolves AppHost `IFileSystemService` and allocates a fresh tracked temporary report directory, then appends reserved MTP reporting arguments. Collection waits for resource completion before resolving the launch-owned report path and stages finalized artifacts even after a nonzero exit. The filesystem service owns temporary cleanup, including failed startup/disposal, subject to its debugging preservation option. `context.TestingContext.OutputPath` is the run root; `context.OutputPath` is the flat logical-resource directory. Only this invocation's canonical `results.trx` is read. Staging rejects source/destination links and reparse points, refuses overwrites, and does not traverse TRX attachment references. Missing/malformed reports and collector errors fail explicitly; malformed raw artifacts remain staged. Cancellation interrupts waits and copying. The cumulative `playground/AspireCliTesting` fixture preserves the foundation service/probe/cleanup and source-dashboard wiring. ### Outcomes and reporting Explicit TRX mappings: Passed → Passed, Failed → Failed, NotExecuted → Skipped, Inconclusive → Inconclusive, Error → Error, Timeout → TimedOut, Aborted → Cancelled. Only Passed and Skipped are non-failing. Published TimedOut/Cancelled cases cause ordinary CLI test failure23, not command timeout17 or interruption130. Unknown/progress-only states are parser errors. Counter reconciliation and strict identities prevent double-counting. A failed TRX run summary causes a collection error when no individual failing outcome explains it, without fabricating cases or rewriting real Passed/Skipped results; with failing cases, collection can complete successfully while the overall test outcome fails. Current MTP serializes timeout rows as Failed, retaining timeout only in aggregate counters, and collapses error/cancellation into Failed. Those rows remain Failed: this integration does not infer identities or recover categories lost upstream from messages/counters. Sources: [TRX serializer](https://github.com/microsoft/testfx/blob/v4.4.0/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.cs), [MTP state converter](https://github.com/microsoft/testfx/blob/v4.4.0/src/Platform/Microsoft.Testing.Extensions.TrxReport/Streaming/TrxTestResultExtractor.cs), [TRX outcomes](https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestOutcome.cs). The inherited unreleased CLI contract is schemaVersion1: resource-keyed `testResults` contains independent execution, collector and case observations; `testSummary` contains the overall outcome and actual passed/failed/skipped counts. Partial cases survive collection failure; resource-only observations do not fabricate case counts. Multi-replica observations are keyed by actual resource ID. Backchannel v1 is unchanged. The playground artifact lookup is `testResults[resourceName].outputPath`; previously declined feature-opt-in README prose was not reintroduced. The inherited spec/timeout helpers remain unchanged, including proposed-only AddCargoTest. ### Validation and readiness Nov26 validated parent `8457d04b28670374abc750f30749dff74bcb2fc6`, macOS arm64 with the repository SDK: **81 focused tests and cumulative AppHost build passed**. Final head differs only by José's replica wording and James's failed-summary README corrections; executable tests were not repeated solely for those documentation edits. Wording was checked against the exact `report.Failed && report.Results.All(result => result.Outcome is TestOutcome.Passed or TestOutcome.Skipped)` collection condition; whitespace checks passed. - `dotnet test --project tests/Aspire.Hosting.Dotnet.Tests/Aspire.Hosting.Dotnet.Tests.csproj --no-launch-profile -- --filter-class '*.MsTest*' --filter-not-trait 'quarantined=true'` — passed79, including two explicitly targeted real isolated MTP pass/fail runners, parser/outcome/counter handling, staging/link rejection, cancellation, cleanup, callback replacement and ordinary run/publish behavior. - `dotnet test --project tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-launch-profile -- --filter-method '*.GeneratesOneAddMsTestMethodWithTypedOptionsAndExecutableCapabilities' --filter-method '*.Scanner_WithTesting_ExportsSingleOptionalRuntimeCollector' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed2; generated API/context/callback exports unchanged. - `dotnet build playground/AspireCliTesting/apphost.cs --verbosity quiet` — passed. Range-diff confirms all eight original patches unchanged; current main ancestry, whitespace and clean worktree verified. No RunCommand or RunCommandStrings diff against current main. GitHub currently reports MERGEABLE/conflict-free, APPROVED, and BLOCKED while checks run. The existing approval was submitted on the earlier patch-identical head and remains retained by GitHub. Final-head [CI45747652984](https://github.com/microsoft/aspire/actions/runs/45747652984) is pending, [native45747652413](https://github.com/microsoft/aspire/actions/runs/45747652413) and automated review are running; no current-head green CI claim is made. The earlier parent [CI45743335067](https://github.com/microsoft/aspire/actions/runs/45743335067) and [native45743334822](https://github.com/microsoft/aspire/actions/runs/45743334822) are historical links, not final-head results. No unconditional merge-ready claim is made. The foundation is merged, no longer an open stack prerequisite. Previous Nov25 head `cdfe8f543daf1d52b5d51930ce6f7e38ceea73ea`, before the foundation squash merge/server rebase, passed132 focused tests and the AppHost build. In addition to the same79 MSTest/two export tests above, `dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class '*.TestRunReporterTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` passed51, including schemaVersion1 resource-keyed reporting, replicas, retained partial cases and independent execution/collection/case outcomes. These51 reporter tests were not rerun in the Nov26 reconciliation; MSTest executable code is unchanged. Historical evidence, not rerun whole-CLI coverage on this head: Nov23 parent `baf66756d9846c6bc7fb16179ef77c9d00940c20` passed211 focused tests plus AppHost build, and actual isolated source-CLI pass/fail invocations verified four passed/zero failed/one skipped (exit0), and three passed/one failed/one skipped (exit23, MSTest exit2), completed collection, staged TRX/probe artifacts and persisted-summary equality. Those historical JSON runs used the transient schemaVersion2 before correction to1; no compatibility promise is implied. No full CLI runtime, other guest SDK suite, user AppHost/browser/terminal operation or global config change was performed for this reconciliation. ### Security assumptions Runs trusted local test code, not sandboxed workloads. Structured arguments avoid shell concatenation; reporting redirection, response files, server mode and retry options are reserved. XML disables DTD/external resolution, bounds size and validates identities/counters. Staging rejects links/reparse points, does not traverse attachment references and never overwrites files. Foundation/CLI owns private runtime directories; runner files and staged copies use their writer's permissions, not a per-file0600 guarantee. Process/artifact handling still needs review. ## Checklist - Is this feature complete? - [ ] Yes. Ready to ship. - [x] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [x] Yes - If yes, did you have an API Review for it? - [ ] Yes - [x] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [x] Yes - [ ] No - [ ] No - Does the change make any security assumptions or guarantees? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No --------- Co-authored-by: Copilot App <[email protected]>
Description
Add experimental built-in Cargo testing to
aspire test.WithCargoTestingmarks a finite nativecargo [+toolchain] testexecutable for authoritative resource/process outcomes and durable diagnostics, without individual Rust testcase publication. Requires normal Rust tooling only: no nextest, nightly compiler, generated runner config or JUnit. No AddCargoTest API is included.Current stack provenance
November 23 schema-one/README propagation: Rust
af6a2e7e6cbacd68e9832185f51d8592e3d1ccb2targets Go #21585 (mitchdenny-go-testing-integration) at22319b0a22b153e4f4368cfd2225634010ff02aa, with foundation15048f5c78f081bbb534b0d81b842ab588966236verified ancestor. Rebased only seven owned patches from verified historical boundary45a1c623bd6686a68ed0a1c56f110f2788ea62ea. README conflicts resolved retaining cumulative Rust content plus inheritedtestResults[resourceName].outputPathcorrection. Final README differs from prior Rust solely by that line. Four patches identical by range-diff; three differ only in README hunk context. Cargo source/tests and runtime behavior unchanged. Pushed only Rust using explicit lease against observed7b94df1e6a66b7c746147091740d85092af8c659.Resource-keyed JSON retains
testResults/testSummary; schemaVersion is 1, with no legacy compatibility or migration machinery. Inherits infinite default timeout/collector enforcement/WithTestingTimeout and capture deadline cancellation unchanged. RunCommand/strings match pinned main79127e0afa9cb87a5ba21abf5531441a33486a39. Stack bases/readiness/metadata unchanged, foundation ready/uppers draft, Dashboard #21646 closed. No other branch pushes, merge or user runtime actions. Declined opt-in README prose remains omitted.Usage and contract
Experimental
ASPIRETESTING001, diagnostic URLhttps://aka.ms/aspire/diagnostics/{0}. CLI registration defaults off; use invocation-scoped opt-in, never global config:features__testCommandEnabled=true \ ./run-aspire.sh test --apphost playground/AspireCliTesting/apphost.cs --isolated \ --timeout-seconds 120 --format json --non-interactiveUse the flag for failure/keep-alive/dashboard opt-out invocations too; hosting APIs and ordinary aspire run do not require it.
Capability
Aspire.Hosting.Rust/withCargoTestingreturns ExecutableResourcePromise. Preserves workspace/package/features/profile/target/manifest/config/environment/filter arguments and normal unit/integration/default-doctest semantics. Zero selected tests may succeed; --no-run compiles only. Aspire does not infer cases/counts/statuses from human logs. Rust publishes zero individual cases, not an assertion that no tests ran. Build/test/doctest failures retain authoritative native failure and fail the run independently of completed collection. Seven inherited TestOutcome members unchanged; only Passed/Skipped non-failing, Cargo publishes none.Cargo uses runtime
WithTesting(context => context.CaptureOutputAsync()), never model-time collection. Command/environment/native one-invocation/restart safeguards are configured separately before launch. Repeated WithTesting replaces callback; marker-only clears it, retaining context/path and guards. No TestingOptions/CollectResults/aliases.context.TestingContext.OutputPathis run root;context.OutputPathis logical resource directory. Capture waits completion including failure and drains separate durable timestamp-free EOF streams to private flat<run>/<resource-name>/stdout.log,stderr.log, thenoutput.complete. One native invocation only, no terminals/replicas/restarts/retries. Concurrent capture shared; caller-local wait cancellation doesn't poison shared completion. Run/collection deadline cancellation stop streams, may leave partial files, must not create marker. Collection errors independent of execution failure. Ordinary runs execute Cargo without collection; publish excludes testing resource. No shell/new process service.JSON schemaVersion 1 has resource-keyed
testResults, nestedtestCases, collectorStatus/error/outputPath/execution andtestSummaryoverall with actual case counts. No obsolete top-level status/resources/collections/publishedResults. Cargo has no case entries but authoritative execution outcome. Backchannel v1 unchanged.Cumulative playground retains shared service/foundation/MSTest/pytest/Go/Rust/source dashboard and opt-outs, Rust inside inherited try/finally probe-cleanup scope, source AspireProjectOrPackageReference. Dependency-free fixture uses RUST_SERVICE_URL, /health and / body
Aspire CLI testing, independent RUST_PLAYGROUND_FAIL, ignored example and passing doctest. No private hive or machine paths.Current validation and reused evidence
macOS arm64, repository .dotnet first PATH, MSBUILDTERMINALLOGGER=false; current pushed tree:
dotnet test --project tests/Aspire.Hosting.Rust.Tests/Aspire.Hosting.Rust.Tests.csproj --no-launch-profile -- --filter-class "*.CargoTestingTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.TestRunReporterTests" --filter-class "*.TestCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-launch-profile -- --filter-class "*.CargoTestingExportTests" --filter-class "*.GoTestExportTests" --filter-class "*.MsTestExportTests" --filter-class "*.PytestExportTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"git diff --check149 passed for this propagation. Restore reused from the earlier same-day wave: passed with 12 pre-existing NuGet vulnerability warnings, zero errors, no dependency edits.
Broader unchanged-source evidence from prior Rust
7b94df1e6a66b7c746147091740d85092af8c659, not rerun here: Rust regular187 pass/1 platform skip, core capture/collector/streaming/coordinator126 pass including deadline cancellation, RPC220 pass, exports4 pass, TwoPass5 pass, reporter/command130 pass (then-current schema), cumulative AppHost/source-dashboard build passed. Prior wave total672/1 skip. Reporter/command tests specifically rerun now for schemaVersion1.Native Cargo outerloop/mixed CLI/CLI E2E/cross-platform/live dashboard/cancellation/grandchild runtime were not rerun. Earlier Cargo-through-DCP pass/assertion failure/build failure/empty crate/doctest failure and mixed default10/0/3 CLI0, Rust-only failure same case counts/CLI23 are historical only. CI not confirmed green; foundation owner monitors, separate Homebrew blocker not addressed here. No user's active AppHost/browser/terminal actions, global settings or dependency edits. API/formal security review pending; keep draft.
Original failure stderr was
error: no such command: nextest; exit101 alone wasn't diagnosis. User-directed simplification removes the dependency, not a PATH workaround. Diagnostics may be sensitive and remain private foundation-owned artifacts. No generated config/XML parsing/shell/credentials/global installs/listeners; native guards preserve capture lifetime. Formal security review not performed.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?