Reorganize unit tests into source-matched files#8800
Conversation
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
be4bd8f to
101e273
Compare
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
…erage files Clean up stale test-name suffixes, line-number comments, and duplicate imports Reorganize remaining suffix-style catch-all test files (_extra/_additional) Check in testreorg tooling; fix stale doc references to retired test files Strip remaining file-derived test/helper name suffixes missed by first pass Deduplicate reorganized unit tests and clean up file-derived helper names Restore minor test assertions lost during dedup (fresh-eyes pass)
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
101e273 to
e0127a3
Compare
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
jongio
left a comment
There was a problem hiding this comment.
I verified this reorganization against main. Key checks:
Test integrity: Total test count goes from 8,943 to 8,884 (59 removed via deduplication). No duplicate test function names detected in cmd/, pkg/project/, or internal/grpcserver/. Spot-checked specific moves (copilot, hooks, env_remove) and confirmed all test functions landed in the correct source-matched files.
No production code changes: Only 3 non-test files touched, all documentation reference updates (AGENTS.md, tracing-in-azd.md, perf-foundations/spec.md). Each correctly updates retired file names to their new locations.
Stale reference scan: Searched all markdown and Go source files on the PR branch for references to retired file patterns (coverage_test, coverage3_test, additional_test, extra_test). None found.
Tooling cleanup: The testreorg migration tooling was checked in, used, and fully removed in the final commit. No artifacts remain, and the temporary cspell entries for tooling files were also cleaned up.
CI: All checks pass, including builds and test runs on Linux, Mac, and Windows.
One observation for the team: the 59 test reduction is modest (0.66%), but since the PR description mentions deduplication, it would be helpful to have a brief accounting of which tests were intentional duplicates vs. which were consolidated. The fresh-eyes pass commit that restored dropped assertions is reassuring, but with 298 changed files, a summary of what was deduped vs. dropped would help reviewers verify completeness.
Fixes #8799
This PR reorganizes the
cli/azdunit test suite so that tests live alongside the source they exercise, retiring the large collection of catch-all "coverage" and suffix-style test files that had accumulated over time. Previously, many packages carried generically named files such as*_coverage_test.go,*_coverage3_test.go,*_additional_test.go, and*_extra_test.gowhose contents had no clear relationship to any particular source file, making it hard to discover where a given function was tested or where new tests should go.The change moves each test into the
<source>_test.gofile that matches the production file under test (for example, tests forcontainer_helper.gonow live incontainer_helper_test.gorather thancontainer_helper_coverage3_test.go), and removes the now-empty catch-all files. In total 106 catch-all files were retired and their tests consolidated into source-matched files spanningcmd/,internal/, andpkg/. Along the way, file-derived test and helper name suffixes (e.g. names ending inCoverage3,Additional,Extra) were stripped so test and helper names describe behavior rather than the file they happened to live in, and duplicate tests, stale line-number comments, and redundant imports introduced by the original split were cleaned up. A fresh-eyes pass restored a handful of minor assertions that were inadvertently dropped during deduplication.The reorganization is purely structural: no production code is modified and the set of behaviors covered is unchanged. The only non-test edits update stale references to retired file names in
cli/azd/AGENTS.md,cli/azd/docs/tracing-in-azd.md, anddocs/specs/perf-foundations/spec.md(notablycmd/telemetry_coverage_test.gobecomingcmd/telemetry_test.go), plus a cspell dictionary update. Temporary migration tooling used to perform the moves was checked in to drive the bulk edits and then removed once the reorganization was complete.