Before running tests, ensure you have:
- Python 3.9+ installed
- Ansible 2.13+ installed
- Molecule installed:
pip install molecule molecule-podman
- Podman installed and running
- Test user account created:
sudo useradd -m -s /bin/bash test-user
cd roles/kvmhost_setup
molecule test
- Basic KVM host setup
- Network bridge configuration
- Storage pool management
- User access control
- Cockpit integration
Test results are displayed in the terminal. Detailed logs are available in:
molecule/default/logs/
molecule/default/reports/
ansible-playbook -i inventories/test/hosts test.yml
ansible-playbook tests/integration.yml -i inventories/test/hosts
- Role dependencies
- Variable validation
- System configuration
- Service status verification
- Push to main branch
- Create pull request
- Manual workflow dispatch
- Python versions: 3.9, 3.10
- Ansible versions: 2.13, 2.14, 2.15
podman build -t kvmhost-test -f Dockerfile .
podman run --privileged \
-v ${PWD}:/ansible \
kvmhost-test \
ansible-playbook tests/integration.yml
podman run -it --privileged \
-v ${PWD}:/ansible \
kvmhost-test \
/bin/bash
- Permission Denied: Ensure Podman is running and you have proper permissions
- Network Issues: Verify Podman network configuration
- Test Failures: Check logs in
molecule/default/logs/
- Use
-vvv
flag for verbose output - Check container logs with
podman logs <container_id>
- Run individual test scenarios with
molecule converge
-
curl Package on Rocky Linux 9
- Issue: Package conflict between curl-minimal and curl
- Error:
package curl-minimal conflicts with curl provided by curl
- Workaround: Skip curl installation on Rocky Linux 9 systems
-
Package Dependencies
- unzip package required for synth-shell extraction
- libvirt packages must be installed before user creation (for libvirt group)
- Order of operations is critical:
- Install base packages (including libvirt)
- Create user and add to libvirt group
- Install remaining packages
- Configure services
-
libvirt Group
- Issue: libvirt group must exist before user creation
- Solution: Install libvirt packages before creating test user
- Fixed: Package installation order adjusted in converge.yml
-
Privileged Container Requirements
- Container must run with
--privileged
flag - Required capabilities:
SYS_ADMIN
- Required volumes:
/sys/fs/cgroup:/sys/fs/cgroup:ro
- Required tmpfs mounts:
/run
,/tmp
- Container must run with
-
Storage Setup
- Minimum disk space: 10GB for testing
- LVM support required
- XFS filesystem support needed
-
Network Requirements
- Bridge networking capability
- NetworkManager running
- Firewall rules for libvirt