Repository navigation
Fix flaky RemoteHost StartupExit test: avoid crash dumps for expected test-server failures - #21497
Conversation
The IntegrationHostProcessTests fixture's generated test server let expected startup/recovery failures escape Program.Main as unhandled exceptions. On CI the test platform's --crashdump settings are inherited by child processes, so each expected failure wrote a full crash dump (9.7-16.3s) before the process exited, exceeding StartupExit's 15s exit deadline. Handle the failure in the generated host, write it to stderr, and exit with a dedicated code (87). Failure-path tests now assert that exact exit code instead of NotEqual(0), which fails (134) while the server still crashes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21497Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21497" |
Tests selector1 / 100 PR test projects · 0 PR jobs, from 2 changed files. Selected PR test projects (1 / 100)
Selected PR jobs (0)none How these were chosen — grouped by what changed🧪 🧪 Job reasonsnone Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-infrastructure changes.
No open issues 🎉
What changed in this PR
This PR addresses a flaky RemoteHost process test by handling expected test-server failures without triggering runtime crash dumps. Changes are limited to test infrastructure; product code and timeouts remain unchanged.
Changes:
- Catch server failures, preserve exception diagnostics on stderr, and exit with code
87. - Strengthen failure-path tests to require the handled-failure exit code rather than any nonzero exit.
| File | Description |
|---|---|
tests/Aspire.Hosting.RemoteHost.Tests/TestServices/IntegrationHostProcessFixture.cs |
Handles server exceptions and defines the dedicated failure exit code. |
tests/Aspire.Hosting.RemoteHost.Tests/IntegrationHostProcessTests.cs |
Asserts the dedicated exit code across expected failure scenarios. |
Review effort: Balanced
|
Related flake covered by this PR: I vetted this test from the same PR-rerun scan: ci.yml PR runs from Oct 16–30, where 503 runs had a rerun. It failed on attempt 1 in 3 of those runs.
🤖 Posted by AspireAgent (AI Agent) |
|
✅ No documentation update needed. docs_optional → test_only Triggered signals (1): |
Description
Fixes the intermittent
IntegrationHostProcessTests.StartupExit_FailsPromptlyAndPreservesRuntimeDiagnosticstimeout inAspire.Hosting.RemoteHost.Tests. No issue tracks it.Flake evidence (first attempts, ci.yml, Oct 16–30)
Root cause
The fixture's generated test server (
IntegrationHostProcessFixture.HostProgram) lets expected server failures escapeProgram.Mainas unhandled exceptions. This includes startup failure, missing command, startup deadline, crash-loop and changed signature, which come fromhost.RunAsync()orIntegrationHostLauncher.ThrowIfFailed().On CI the test platform runs with
--crashdump. TheDOTNET_DbgEnableMiniDump*settings are inherited by the child test server, so every expected failure crashes the runtime and writes a full dump before the process exits. Each failing log shows the sequence:StartupExitwaits onlyserver.Exit.WaitAsync(15s), so whenever dump writing took about 10–16s the test timed out. The other failure-path tests use 30s deadlines but pay the same cost, and every one of them leaves a 250–300MB dump.Fix (test infrastructure only)
TargetInvocationExceptionfrom the reflectedThrowIfFailed), and sets the dedicatedEnvironment.ExitCode = 87. All diagnostics the tests assert on are kept, includingexited with code 23and the recovery messages.StartupExit,MissingCommand,StartupDeadline×2,CrashLoop,ChangedSignature) now assertAssert.Equal(HostFailureExitCode, server.ExitCode)instead ofNotEqual(0), or in addition to the existing checks forStartupExit. This assertion is stricter and is the regression check: it fails while the server crashes. On Linux a crashed server exits with 134 (SIGABRT).No product code changes. No timeouts were changed, and no sleeps or retries were added.
Before/after (local, Linux)
Run with
--filter-class *IntegrationHostProcessTestsand crash dumps enabled (DOTNET_DbgEnableMiniDump=1), as on CI:Expected: 87, Actual: 134The full
Aspire.Hosting.RemoteHost.Testssuite passes after the fix: 686 passed, 0 failed, 5 skipped.Checklist
🤖 Posted by AspireAgent (AI Agent)