From df70e278edc27ed33f3c7496696df42c813e50cd Mon Sep 17 00:00:00 2001 From: Clint Branham Date: Wed, 25 Mar 2026 13:25:49 -0500 Subject: [PATCH] fix: inject pwsh variables directly instead of using -- separator PowerShell's -Command doesn't support the -- argument separator for param() blocks. Inject $PveVersion and $TestFilter as variable assignments at the top of the script string instead. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../infrastructure/scripts/run-integration.sh | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/tests/infrastructure/scripts/run-integration.sh b/tests/infrastructure/scripts/run-integration.sh index 036c2c1..cb17a33 100755 --- a/tests/infrastructure/scripts/run-integration.sh +++ b/tests/infrastructure/scripts/run-integration.sh @@ -393,43 +393,44 @@ cmd_test() { log "Test filter: $test_filter" fi - pwsh -NoProfile -Command ' - param($PveVersion, $TestFilter) + pwsh -NoProfile -Command " + \$PveVersion = '$v' + \$TestFilter = '$pester_filter_arg' Import-Module Pester -MinimumVersion 5.0 - $config = New-PesterConfiguration + \$config = New-PesterConfiguration - if ($TestFilter) { + if (\$TestFilter) { # Build list of matching test files - $integrationDir = "tests/PSProxmoxVE.Tests/Integration" - $areas = $TestFilter -split "," - $paths = @() - foreach ($area in $areas) { - $area = $area.Trim() - $matches = Get-ChildItem "$integrationDir/*${area}*.Tests.ps1" -ErrorAction SilentlyContinue - if ($matches) { - $paths += $matches.FullName + \$integrationDir = 'tests/PSProxmoxVE.Tests/Integration' + \$areas = \$TestFilter -split ',' + \$paths = @() + foreach (\$area in \$areas) { + \$area = \$area.Trim() + \$matched = Get-ChildItem \"\$integrationDir/*\${area}*.Tests.ps1\" -ErrorAction SilentlyContinue + if (\$matched) { + \$paths += \$matched.FullName } else { - Write-Warning "No test files matched filter: $area" + Write-Warning \"No test files matched filter: \$area\" } } - if ($paths.Count -eq 0) { - Write-Error "No test files matched any filter in: $TestFilter" + if (\$paths.Count -eq 0) { + Write-Error \"No test files matched any filter in: \$TestFilter\" exit 1 } - $config.Run.Path = $paths - Write-Host "Running $($paths.Count) test file(s):" - $paths | ForEach-Object { Write-Host " $_" } + \$config.Run.Path = \$paths + Write-Host \"Running \$(\$paths.Count) test file(s):\" + \$paths | ForEach-Object { Write-Host \" \$_\" } } else { - $config.Run.Path = "tests/PSProxmoxVE.Tests/Integration" + \$config.Run.Path = 'tests/PSProxmoxVE.Tests/Integration' } - $config.Filter.Tag = "Integration" - $config.Output.Verbosity = "Detailed" - $config.TestResult.Enabled = $true - $config.TestResult.OutputFormat = "NUnitXml" - $config.TestResult.OutputPath = "TestResults/integration-results-pve${PveVersion}.xml" - Invoke-Pester -Configuration $config - ' -- "$v" "$pester_filter_arg" || test_exit=$? + \$config.Filter.Tag = 'Integration' + \$config.Output.Verbosity = 'Detailed' + \$config.TestResult.Enabled = \$true + \$config.TestResult.OutputFormat = 'NUnitXml' + \$config.TestResult.OutputPath = \"TestResults/integration-results-pve\${PveVersion}.xml\" + Invoke-Pester -Configuration \$config + " || test_exit=$? if [[ $test_exit -ne 0 ]]; then ci_error "PVE $v integration tests failed (exit code $test_exit)"