2.3 KiB
2.3 KiB
Rocky Linux Testing Framework
Simple, portable testing framework for Rocky Linux using Sparrowdo.
Quick Start
Prerequisites
sudo dnf install -y qemu-kvm libvirt virt-install guestfs-tools rakudo
sudo systemctl enable --now libvirtd
sudo usermod -a -G libvirt $(whoami)
Manual Test
# Download base image
BASE=$(./scripts/download-image.sh https://download.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud-Base.latest.x86_64.qcow2)
# Build golden image (includes Sparrowdo bootstrap)
./scripts/build-golden.sh "$BASE" /var/lib/libvirt/images/golden.qcow2
# Run a test
./scripts/run-test.sh my-test https://github.com/your-org/test-repo.git /var/lib/libvirt/images/golden.qcow2
# Cleanup
./scripts/cleanup-all.sh
Jenkins
- Create Pipeline job
- Point to
Jenkinsfile.simple - Set parameters:
QCOW2_URL: Rocky Linux image URLTEST_REPOS: One repo URL per lineMAX_PARALLEL: Number of concurrent tests
Scripts
download-image.sh- Download/cache QCOW2 imagesbuild-golden.sh- Create golden image with Sparrowdorun-test.sh- Run single test in isolated VMprovision_vm.sh- Create and start VMcleanup_vm.sh- Destroy VMcleanup-all.sh- Emergency cleanup
How It Works
- Download Rocky Linux QCOW2 (cached)
- Build golden image:
- Install Raku, Sparrowdo, dependencies
- Create
rockyuser with sudo - Inject SSH keys
- Bootstrap Sparrowdo
- For each test:
- Provision VM (linked clone, fast)
- Clone test repo
- Run
sparrowdo --no_sudo - Cleanup VM
Test Repository Format
Your test repo needs either sparrowfile or main.raku:
#!/usr/bin/env raku
use Sparrowdo;
task-run 'check-service', %(
plugin => 'systemd-service',
args => ['sshd', 'running']
);
Portability
All logic is in shell scripts. Easy to move to:
- GitHub Actions: Call scripts in workflow
- GitLab CI: Call scripts in
.gitlab-ci.yml - Windmill: Call scripts as tasks
- Manually: Run scripts directly
Troubleshooting
# List VMs
virsh -c qemu:///system list --all
# Get VM IP
virsh -c qemu:///system domifaddr <vm-name>
# SSH to VM
ssh -i ~/.ssh/id_rsa rocky@<ip>
# View VM console
virsh -c qemu:///system console <vm-name>
# Force cleanup
./scripts/cleanup-all.sh