Improve Windows test reliability#9161
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Improves Windows functional-test reliability by isolating extension state, retrying transient filesystem locks, and routing terminal output through injected writers.
Changes:
- Adds cross-platform resilient directory cleanup.
- Isolates extension tests and guards fixture assertions.
- Propagates writers through tool and UX components and documents reliability practices.
Show a summary per file
| File | Description |
|---|---|
docs/guides/adding-a-new-command.md |
Adds reliability guidance. |
cli/azd/AGENTS.md |
Documents testing and writer conventions. |
cli/azd/docs/recording-functional-tests-guide.md |
Expands functional-test isolation guidance. |
cli/azd/cmd/tool.go |
Routes spinner output to the action writer. |
cli/azd/pkg/extensions/manager.go |
Uses resilient extension cleanup. |
cli/azd/pkg/osutil/rename_unix.go |
Adds Unix RemoveAll. |
cli/azd/pkg/osutil/rename_windows.go |
Adds retrying Windows RemoveAll. |
cli/azd/pkg/osutil/rename_windows_test.go |
Tests locked-file cleanup. |
cli/azd/pkg/ux/confirm.go |
Propagates the confirm writer. |
cli/azd/pkg/ux/multi_select.go |
Propagates the multi-select writer. |
cli/azd/pkg/ux/prompt.go |
Propagates the prompt writer. |
cli/azd/pkg/ux/select.go |
Propagates the select writer. |
cli/azd/test/functional/cli_test.go |
Reuses shared resilient cleanup. |
cli/azd/test/functional/extension_test.go |
Isolates extension test state. |
cli/azd/test/functional/up_test.go |
Guards fixture type assertions. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 7
- Review effort level: Medium
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 73c24c8d-f132-424d-a406-e57aa0984576
d7d52b3 to
f924f6a
Compare
| spinner := uxlib.NewSpinner(&uxlib.SpinnerOptions{ | ||
| Text: spinnerText, | ||
| ClearOnStop: true, | ||
| Writer: writer, |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
| cli.Env = append(cli.Env, os.Environ()...) | ||
| cli.Env = append(cli.Env, "AZURE_LOCATION=eastus2") | ||
| // Required when the test installs extensions or changes user-level azd state. | ||
| cli.Env = append(cli.Env, "AZD_CONFIG_DIR="+configDir) |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Fixes #9162
This PR improves Windows test reliability by addressing the initiating extension cleanup race and the failures it caused in later tests.
Issue
Windows can briefly retain a lock on an extension executable after the process exits. The force-install test then failed to replace the extension, leaked global extension state, and caused unrelated tests to fail or prompt unexpectedly.
failed to remove extension: ... Access is deniedgo test -jsonstream.Changes
Testing
Covered the Windows lock retry, extension force-install flow, command JSON-stream integrity, UX writer behavior, and functional-test compilation with focused package and functional tests.