feat(ci): path detector + Invoke-GoTest wrapper (#562 2/4)#572
feat(ci): path detector + Invoke-GoTest wrapper (#562 2/4)#572WilliamBerryiii wants to merge 5 commits into
Conversation
- Detect-Folder-Changes.ps1: add Test-IsGoContractTestChangeFile, Test-GoContractTestHasChange, Test-IsTerraformInstallChangeFile - Invoke-GoTest.ps1: new opt-in runner for full-single-node-cluster Go contract tests; emits goContractTestsRan and goContractTestsExitCode CI outputs - package.json: add 'go-test' npm script wrapper - Pester: 27/0/0 (Detect-Folder-Changes) and 14/0/0 (Invoke-GoTest) Closes #568 Relates to #562 🔒 - Generated by Copilot
bindsi
left a comment
There was a problem hiding this comment.
🤖 Automated review: CI path detector and Invoke-GoTest wrapper. Adds Go contract test infrastructure with proper test utilities import, Bicep/Terraform contract validation, and CI workflow integration. No security or functional issues detected in the test scaffolding.
…tor-wrapper # Conflicts: # blueprints/minimum-single-node-cluster/tests/go.mod # blueprints/minimum-single-node-cluster/tests/go.sum # blueprints/only-cloud-single-node-cluster/tests/go.mod # blueprints/only-cloud-single-node-cluster/tests/go.sum # scripts/build/Detect-Folder-Changes.Tests.ps1
Add fallback handling for analyzer path crashes and keep recursive lint discovery out of generated folders. 🛠️ - Generated by Copilot
bindsi
left a comment
There was a problem hiding this comment.
Approved: the CI path detector and Invoke-GoTest wrapper changes are scoped and align with the existing validation patterns. I did not find actionable correctness or security issues.
There was a problem hiding this comment.
The script help text for Detect-Folder-Changes.ps1 describes an older JSON shape than the implementation now returns. The implementation emits applications.folders, while the docs still refer to changed_applications, services, and dependencies, so the contract should be aligned.
Pull Request
Description
Second PR (2 of 4) in the Go static contract tests stack for #562. Adds the path-change detector and the opt-in
npm run go-testwrapper for the Go contract tests, without wiring any CI gate yet. The required check lands in PR 3.Stacked on top of #571.
Related Issue
Closes #568
Relates to #562
Type of Change
Implementation Details
scripts/build/Detect-Folder-Changes.ps1Test-IsGoContractTestChangeFile— classifies a single changed path as relevant to the Go contract test surface.Test-GoContractTestHasChange— boolean roll-up over a change set.Test-IsTerraformInstallChangeFile— classifiesscripts/install-terraform-docs.sh(the Go tests shell out toterraform-docs).blueprints/full-single-node-cluster/{terraform,bicep}/**blueprints/full-single-node-cluster/tests/**/*.goandgo.{mod,sum}src/900-tools-utilities/904-test-utilities/**scripts/install-terraform-docs.shscripts/linting/Invoke-GoTest.ps1scripts/tests/linting/Invoke-GoTest.Tests.ps1.github/workflows/{go-tests,matrix-folder-check,pr-validation}.ymlscripts/build/Detect-Folder-Changes.ps1package.json,package-lock.jsonscripts/linting/Invoke-GoTest.ps1(new)go test . -run '^(TestTerraformOutputsContract|TestBicepOutputsContract)$'inblueprints/full-single-node-cluster/tests.-RepoRoot,-BaseBranch(defaultorigin/main),-ChangedOnlyswitch,-ChangedFiles,-CommandRunner(test injection seam).CIHelpers.psm1+LintingHelpers.psm1.Set-CIOutput -Name 'goContractTestsRan' -Value 'true'|'false'andSet-CIOutput -Name 'goContractTestsExitCode'for a future CI step to branch on.package.jsongo-testnpm script:pwsh -File ./scripts/linting/Invoke-GoTest.ps1.PR 1 added the per-test
terraform-docs.ymlwriter incontract.goand the Go test modules underminimum-andonly-cloud-single-node-cluster. The CI gate (PR 3) needs a deterministic, testable way to (1) decide whether a PR's changes can affect Go contract tests and (2) run those tests locally and in CI through one consistent entry point. This PR delivers both. Until PR 3 lands,npm run go-testis fully opt-in for contributors.Testing Performed
Validation Steps
scripts/tests/build/Detect-Folder-Changes.Tests.ps1— 27 / 0 / 0 (Pester v5.7.1).scripts/tests/linting/Invoke-GoTest.Tests.ps1(new, 14 cases covering arg parsing, change detection, exit-code propagation, CI output emission) — 14 / 0 / 0.npm run go-test— exit 0. Directgo testrun:--- PASS: TestBicepOutputsContract (28.78s)--- PASS: TestTerraformOutputsContract (0.12s)ok github.com/microsoft/edge-ai/blueprints/full-single-node-cluster/tests 29.180snpm run lint— exit 0 (only pre-existing yamllint/hadolint warnings on unrelated files).Checklist
terraform fmton all Terraform codeterraform validateon all Terraform codeaz bicep formaton all Bicep codeaz bicep buildto validate all Bicep codeSecurity Review
This PR does not touch
SECURITY.md,src/000-cloud/010-security-identity/, ordeploy/.Additional Notes
CI shape (added but not activated):
goContractTestsRanandgoContractTestsExitCodeavailable for future steps.Stack (4 of 4 for #562):
contract.go+ minimum/only-cloud Go tests).Invoke-GoTestwrapper +npm run go-test.go-tests.ymlreusable,matrix-folder-check.yml+pr-validation.ymlaggregation).Base branch:
feature/562-pr1-foundation.Screenshots (if applicable)
N/A.
🔒 - Generated by Copilot