Files
lab/bastion/tests/integration/run-pxe-test.sh

28 lines
795 B
Bash
Raw Normal View History

#!/bin/bash
# One-shot PXE integration test runner.
# Compiles, runs unit tests, cleans up, and runs the full integration test.
set -e
cd "$(dirname "$0")/../.."
echo "=== Step 1: Compile ==="
npx tsc --noEmit
echo "✓ Compile OK"
echo ""
echo "=== Step 2: Kickstart unit tests ==="
npx vitest run src/bastion/tests/kickstart.test.ts 2>&1 | tail -5
echo "✓ Unit tests OK"
echo ""
echo "=== Step 3: Clean up ==="
sudo lsof -ti:8099 2>/dev/null | xargs -r sudo kill -9 || true
sudo virsh destroy lab-pxe-test 2>/dev/null || true
sudo virsh undefine lab-pxe-test --nvram 2>/dev/null || true
sudo rm -f /var/lib/libvirt/images/lab-pxe-test.qcow2
echo "✓ Cleanup done"
echo ""
echo "=== Step 4: Integration test ==="
npx vitest run -c /dev/null tests/integration/pxe-provision.test.ts 2>&1