Fix deployment test race condition in agent init prompt handling#16703
Fix deployment test race condition in agent init prompt handling#16703mitchdenny merged 1 commit intomainfrom
Conversation
Two fixes for flaky deployment E2E tests:
1. DeclineAgentInitPromptAsync: Remove Enter after typing 'n' for the
[Y/n] agent init prompt. Spectre Console accepts single-character
input. The Enter was racing with aspire-init exit — if bash received
the Enter, it executed a phantom blank command, advancing CMDCOUNT
and desyncing the test counter from the shell counter. This caused
WaitForAspireAddCompletionAsync to match stale prompts and return
before aspire-add finished, so subsequent commands (env var exports)
were typed into aspire-add's stdin.
2. WaitForAspireAddCompletionAsync: Remove addCompleted and addFailed
text-based matching. These patterns ('added to your AppHost project'
and 'already exists in the project') persist on the terminal from
prior aspire-add runs, causing false matches for subsequent calls
in the same test. Now relies solely on version-selection prompts
and shell counter-based prompt detection.
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 -- 16703Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16703" |
There was a problem hiding this comment.
Pull request overview
This PR hardens the Hex1b-based deployment E2E test automation against prompt/output races that could desync the test SequenceCounter from the bash prompt counter when multiple aspire add commands run in the same terminal session.
Changes:
- Removes Enter submission after declining the agent-init
[Y/n]prompt to avoid “phantom command” execution in bash. - Eliminates
aspire addcompletion detection based on persisted terminal text, relying instead on counter-based shell prompt detection (and version-selection prompts).
|
/deployment-test |
|
🚀 Deployment tests starting on PR #16703... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
🎬 CLI E2E Test Recordings — 75 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25264951789 |
|
✅ Deployment E2E Tests passed — 33 passed, 0 failed, 0 cancelled View test results and recordings
|
|
No documentation PR is required for this change. This PR fixes an internal test infrastructure race condition in deployment E2E tests — it touches only test helper code, with no public API additions, no behavioral changes to user-facing features, and no configuration or CLI changes. The author also confirmed docs are not needed in the PR checklist.
|
Description
Fixes two race conditions in deployment E2E test infrastructure that caused flaky failures in tests with multiple
aspire addcalls (e.g.,AzureKeyVaultDeploymentTests,VnetStorageBlobInfraDeploymentTests,AksWithAzureResourcesDeploymentTests,TypeScriptVnetSqlServerInfraDeploymentTests).Root cause
DeclineAgentInitPromptAsyncwas sending an Enter keypress after typing "n" to the[Y/n]agent init confirmation prompt. This created a race condition: ifaspire initexited after reading "n" but before the Enter was delivered to the PTY, bash received the Enter and executed a phantom blank command, advancingCMDCOUNTby one. This desynced the test'sSequenceCounterfrom bash's prompt counter, causingWaitForAspireAddCompletionAsyncto match stale prompt text and return beforeaspire addfinished. Subsequent commands (environment variable exports, additionalaspire addcalls) were then typed into the still-runningaspire addprocess's stdin, meaning packages were never installed and deployments failed with CS1061 build errors.Changes
DeclineAgentInitPromptAsync: Remove Enter after typing "n". Spectre Console's[Y/n]confirmation prompt accepts single-character input — Enter is unnecessary and caused the phantom command race.WaitForAspireAddCompletionAsync: RemoveaddCompleted("added to your AppHost project") andaddFailed("already exists in the project") text-based matching. These patterns persist on the terminal from prioraspire addruns, causing false matches for subsequent calls in the same test. Now relies solely on version-selection prompts and shell counter-based prompt detection.Validation
Verified with a full deployment E2E test run: 37/37 tests passed (previously 4 failures).
Checklist