Local Testing
Run local checks from the repository root:
.\scripts\Test-Local.ps1 -ConfigFile .\config.local.yamlThe script:
- Parses tracked PowerShell script and module files.
- Validates
AzureSqlVmToolkit.psd1. - Verifies
VERSIONmatches the module manifest. - Parses
schemas/config.schema.json. - Runs
vm_creation_with_bastion.ps1 -Plan. - Runs Pester 5 tests when installed.
- Runs PSScriptAnalyzer when installed.
Install optional local test tooling:
Install-Module -Name powershell-yaml -RequiredVersion 0.4.12 -Scope CurrentUser -ForceInstall-Module -Name Pester -RequiredVersion 5.7.1 -Scope CurrentUser -Force -SkipPublisherCheckInstall-Module -Name PSScriptAnalyzer -RequiredVersion 1.25.0 -Scope CurrentUser -ForceGitHub Actions runs the same local check for toolkit script/config/test changes, and also runs the docs build plus npm audit.
Failure Artifacts For Automation
Section titled “Failure Artifacts For Automation”Use -ErrorLogPath to give automated plan, WhatIf, or deployment tests a machine-readable JSONL artifact when the command fails:
$errorLog = ".\test-results\errors\deployment.jsonl"New-AzureSqlVmToolkitDeployment ` -ConfigFile .\config.local.yaml ` -Plan ` -ErrorLogPath $errorLogNo file is created on success. On failure, use runId, mode, phase, resource.type, resource.name, and azureCorrelationId to group and diagnose runs. Keep the artifact private and review it before publishing it from CI.
Pester coverage verifies redaction, JSONL integrity, restrictive Unix permissions, concurrent writers, path aliases, phase tracking, Plan and WhatIf behavior, and preservation of the original error when diagnostic writing fails.