From 5e37737bc45889e3b68f0e943444eba57597ca76 Mon Sep 17 00:00:00 2001 From: Clint Branham Date: Fri, 20 Mar 2026 16:08:20 -0500 Subject: [PATCH] fix(test): remove Get-PveVm status assertions after suspend/resume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PVE list endpoint (GET /nodes/{node}/qemu) always reports Status=running for paused VMs — qmpstatus is only available from the status/current endpoint. The -Wait -Timeout polling uses status/current internally, so if it returns without throwing, the state transition is confirmed. Also fix restart recovery: use Resume-PveVm -Wait instead of checking Status from list endpoint (which never shows 'paused'). Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Integration/Integration.Tests.ps1 | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/PSProxmoxVE.Tests/Integration/Integration.Tests.ps1 b/tests/PSProxmoxVE.Tests/Integration/Integration.Tests.ps1 index 8be1073..14abe90 100644 --- a/tests/PSProxmoxVE.Tests/Integration/Integration.Tests.ps1 +++ b/tests/PSProxmoxVE.Tests/Integration/Integration.Tests.ps1 @@ -1152,30 +1152,23 @@ Describe 'Integration Tests' -Tag 'Integration' { It 'Should suspend and resume a running VM (Suspend-PveVm / Resume-PveVm)' { if (Skip-IfNoLinuxVm) { return } - # Suspend — -Wait -Timeout polls until status is 'paused' + # Suspend — -Wait -Timeout polls qmpstatus until 'paused' + # Note: PVE list endpoint reports Status=running for paused VMs; + # the -Wait polling uses the status/current endpoint which has qmpstatus. $suspendTask = Suspend-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 30 $suspendTask | Should -Not -BeNullOrEmpty - $vm = Get-PveVm -Node $script:Node | Where-Object { $_.VmId -eq $script:LinuxVmId } - $vm.Status | Should -Be 'paused' - - # Resume — -Wait -Timeout polls until status is 'running' + # Resume — -Wait -Timeout polls qmpstatus until 'running' $resumeTask = Resume-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 30 $resumeTask | Should -Not -BeNullOrEmpty - - $vm = Get-PveVm -Node $script:Node | Where-Object { $_.VmId -eq $script:LinuxVmId } - $vm.Status | Should -Be 'running' } It 'Should gracefully restart a VM via ACPI (Restart-PveVm)' { if (Skip-IfNoLinuxVm) { return } - # Ensure VM is running (not paused from a failed suspend test) - $vm = Get-PveVm -Node $script:Node | - Where-Object { $_.VmId -eq $script:LinuxVmId } - if ($vm.Status -eq 'paused') { - Resume-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 15 -ErrorAction SilentlyContinue | Out-Null - } + # Ensure VM is running (resume if paused from a failed suspend test) + try { Resume-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 10 -ErrorAction SilentlyContinue | Out-Null } + catch { <# already running #> } $task = Restart-PveVm -Node $script:Node -VmId $script:LinuxVmId -Wait -Timeout 60 -Confirm:$false $task | Should -Not -BeNullOrEmpty