feat(test): add Alpine guest-agent VM for ACPI and template tests

Infrastructure:
- build-test-image.sh: Downloads Alpine cloud image, uses virt-customize
  to install qemu-guest-agent, caches at /opt/pve-images/
- prepare-test-vm.sh: SCPs image to nested PVE, creates VM via
  qm importdisk with cloud-init and agent enabled, waits for agent

Workflow:
- Build Alpine image step (cached on runner, only built once)
- Deploy test VM step after provisioning, passes LINUX_VMID to tests

Tests:
- Guest Agent VM lifecycle: verify running, ACPI restart, ACPI stop
- Templates: convert Linux VM to template, clone from template
  (New-PveTemplate, New-PveVmFromTemplate)
- Fix Get-PveTask: use .Upid property instead of whole PveTask object

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-19 11:01:05 -05:00
parent 84029d8871
commit a9f1c066e0
4 changed files with 260 additions and 5 deletions
+22
View File
@@ -176,6 +176,27 @@ jobs:
exit 1
fi
# ── Prepare test Linux VM ──────────────────────────────────────────
- name: Build Alpine test image (cached)
if: inputs.skip_provision != true
shell: bash
run: |
bash ${SCRIPTS_DIR}/build-test-image.sh /opt/pve-images/alpine-guest-agent.qcow2
- name: Deploy test Linux VM to nested PVE
if: inputs.skip_provision != true
id: linux_vm
shell: bash
run: |
OUTPUT=$(bash ${SCRIPTS_DIR}/prepare-test-vm.sh \
"${{ steps.provision.outputs.host }}" \
"${PVE_PASSWORD}" \
"/opt/pve-images/alpine-guest-agent.qcow2" \
200)
LINUX_VMID=$(echo "$OUTPUT" | grep "^LINUX_VMID=" | cut -d= -f2)
echo "linux_vmid=${LINUX_VMID}" >> "$GITHUB_OUTPUT"
# ── Build and test ─────────────────────────────────────────────────
- name: Build module
@@ -209,6 +230,7 @@ jobs:
PVETEST_STORAGE: ${{ steps.target.outputs.storage }}
PVETEST_ISO_PATH: ${{ runner.temp }}/pvetest.iso
PVETEST_PVE_VERSION: ${{ matrix.pve_version }}
PVETEST_LINUX_VMID: ${{ steps.linux_vm.outputs.linux_vmid }}
run: |
Import-Module Pester -MinimumVersion 5.0
$config = New-PesterConfiguration