fix(test): add -Confirm:$false to all ConfirmImpact.High cmdlet calls in tests

ConfirmImpact.High causes interactive confirmation prompts in
non-interactive CI, blocking before ProcessRecord runs. Add
-Confirm:$false to all Stop-PveVm, Reset-PveVm, Remove-*,
Restore-*, and New-PveTemplate calls in both unit and integration tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-20 12:40:54 -05:00
parent 202b472d7a
commit ae55dbf0d7
7 changed files with 18 additions and 18 deletions
@@ -119,7 +119,7 @@ AfterAll {
foreach ($vmId in $script:CreatedVmIds) {
try {
Stop-PveVm -Node $script:Node -VmId $vmId -ErrorAction SilentlyContinue | Out-Null
Stop-PveVm -Node $script:Node -VmId $vmId -Confirm:$false -ErrorAction SilentlyContinue | Out-Null
Start-Sleep -Seconds 3
Remove-PveVm -Node $script:Node -VmId $vmId -Force -Purge -Confirm:$false -ErrorAction SilentlyContinue
}
@@ -381,7 +381,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
$startTask = Start-PveVm -Node $script:Node -VmId $script:TestVmId -Wait
$startTask | Should -Not -BeNullOrEmpty
$stopTask = Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait
$stopTask = Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait -Confirm:$false
$stopTask | Should -Not -BeNullOrEmpty
}
@@ -392,10 +392,10 @@ Describe 'Integration Tests' -Tag 'Integration' {
Start-PveVm -Node $script:Node -VmId $script:TestVmId -Wait | Out-Null
# Hard reset (no ACPI — works even without guest OS)
$task = Reset-PveVm -Node $script:Node -VmId $script:TestVmId -Wait
$task = Reset-PveVm -Node $script:Node -VmId $script:TestVmId -Wait -Confirm:$false
$task | Should -Not -BeNullOrEmpty
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait | Out-Null
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait -Confirm:$false | Out-Null
}
It 'Should clone a VM' {
@@ -430,7 +430,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
# Ensure the VM is stopped for snapshot
$vm = Get-PveVm -Node $script:Node | Where-Object { $_.VmId -eq $script:TestVmId }
if ($vm.Status -eq 'running') {
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait | Out-Null
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait -Confirm:$false | Out-Null
}
$snapName = 'pester-snap'
@@ -525,7 +525,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
$task.IsSuccessful | Should -BeTrue
# Clean up
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait | Out-Null
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait -Confirm:$false | Out-Null
}
}
@@ -667,7 +667,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
It 'Should gracefully restart a VM via ACPI (Restart-PveVm)' {
if (Skip-IfNoLinuxVm) { return }
$task = Restart-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait
$task = Restart-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Confirm:$false
$task | Should -Not -BeNullOrEmpty
# Wait a moment for the VM to come back up
@@ -680,7 +680,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
It 'Should gracefully stop a VM via ACPI (Stop-PveVm)' {
if (Skip-IfNoLinuxVm) { return }
$task = Stop-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait
$task = Stop-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Confirm:$false
$task | Should -Not -BeNullOrEmpty
$vm = Get-PveVm -Node $script:Node |
@@ -698,7 +698,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
$vm = Get-PveVm -Node $script:Node |
Where-Object { $_.VmId -eq $script:LinuxVmId }
if ($vm.Status -eq 'running') {
Stop-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait | Out-Null
Stop-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Confirm:$false | Out-Null
}
{ New-PveTemplate -Node $script:Node -VmId $script:LinuxVmId -Confirm:$false -ErrorAction Stop } |
@@ -745,7 +745,7 @@ Describe 'Integration Tests' -Tag 'Integration' {
# Ensure stopped
$vm = Get-PveVm -Node $script:Node | Where-Object { $_.VmId -eq $script:TestVmId }
if ($vm.Status -eq 'running') {
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait | Out-Null
Stop-PveVm -Node $script:Node -VmId $script:TestVmId -Wait -Confirm:$false | Out-Null
}
{ Remove-PveVm `