Remove unused scaffold testdata bicep files - #9346
Conversation
Deletes cli/azd/internal/scaffold/testdata/TestExecInfra-API_only, a set of generated Bicep files that no code reads. TestExecInfra regenerates infra into a temp dir and validates it with `bicep build`; it never compares against these checked-in files. They exist only as a SCAFFOLD_SAVE=true debugging artifact. These files are picked up by the repo-wide bicep lint job (eng/scripts/Test-BicepLint.ps1), whose resources.bicep pulls br/public AVM modules requiring a network restore, contributing to the occasional transient failures reported in #9341. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3e557227-0014-494a-8bf5-2a76a0985475
🔗 Linked Issue RequiredThanks for the contribution! Please link a GitHub issue to this PR by adding |
|
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
Removes unused generated scaffold fixtures to prevent unnecessary Bicep registry restores during repository-wide linting.
Changes:
- Deletes the saved
API onlyscaffold output. - Leaves
TestExecInfrabehavior and coverage unchanged.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
resources.bicep |
Removes generated resource definitions. |
modules/fetch-container-image.bicep |
Removes generated helper module. |
main.parameters.json |
Removes generated deployment parameters. |
main.bicep |
Removes generated entry-point template. |
abbreviations.json |
Removes generated naming data. |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Context
While investigating #9341 (the
bicep-lintCI job failing randomly on PRs that touch no Bicep), I looked into why CI lints files undercli/azd/internal/scaffold/testdata/TestExecInfra-API_only/(see my comment on the issue).What these files are
cli/azd/internal/scaffold/testdata/TestExecInfra-API_only/holds a set of generated Bicep/JSON files (main.bicep,resources.bicep,modules/*.bicep, etc.). They were checked in by the original compose PR (#4527).Why they are useless to keep checked in
TestExecInfra(cli/azd/internal/scaffold/scaffold_test.go) is not a snapshot/golden test. For each case it:t.TempDir()viaExecInfra(...).bicep buildon the generatedmain.bicep.The oracle is the Bicep compiler/linter, not a checked-in baseline. The test never reads
testdata/— it only writes to it, and only when you opt in withSCAFFOLD_SAVE=true, purely as a developer convenience to eyeball the generator output. Tellingly, only 1 of the test's 7 sub-cases has a saved folder, yet all 7 pass. The files are never used as an expected value.Why removing them is safe
go:embed, and no reference toTestExecInfra/this path anywhere incli/,eng/, or.github/except the test itself.go test ./internal/scaffold/ -run TestExecInfrastill passes (all sub-cases green), because the test regenerates and lints in a temp dir.Why this helps #9341
The repo-wide Bicep lint job (
eng/scripts/Test-BicepLint.ps1) recursively runsbicep buildon every*.bicepin the repo, which sweeps up these testdata files. Theirresources.bicepreferences sixbr/public:avm/...modules, so linting them requires a network restore from the public registry. When that restore hits a transient network hiccup, the lint job fails — on files nobody touched. Removing these files eliminates that restore surface and should reduce the occasional noise reported in #9341.Testing
go test ./internal/scaffold/ -run TestExecInfra→ passes with the folder removed.bicep-lintjob to confirm behavior without the folder.Fixes #9352.