Test Scenarios¶
Overview¶
Solti-Monitoring provides multiple test scenarios for different testing needs and environments.
Available Scenarios¶
default¶
Purpose: Quick local testing during development
Platform: Podman containers OS: Debian 12 Duration: 2-3 minutes Use case: Rapid feedback during development
Command:
Configuration:
# molecule/default/molecule.yml
driver:
name: podman
platforms:
- name: debian12
image: debian:12
systemd: true
command: /lib/systemd/systemd
podman¶
Purpose: Multi-distro container testing
Platforms: - Debian 12 - Rocky Linux 9 - Ubuntu 24.04
Duration: 5-8 minutes Use case: Test across all supported distributions
Command:
Configuration:
# molecule/podman/molecule.yml
platforms:
- name: debian12
image: debian:12
systemd: true
- name: rocky9
image: rockylinux:9
systemd: true
- name: ubuntu24
image: ubuntu:24.04
systemd: true
proxmox¶
Purpose: Full VM testing on Proxmox hypervisor
Platform: Proxmox VMs OS: Varies by configuration Duration: 10-15 minutes Use case: Production-like integration testing
Requirements: - Proxmox server access - Pre-configured VM templates - Network connectivity to VMs
Command:
Configuration:
# molecule/proxmox/molecule.yml
driver:
name: delegated
platforms:
- name: test-debian12
groups:
- proxmox_vms
provisioner:
inventory:
group_vars:
proxmox_vms:
ansible_user: root
ansible_host: "{{ lookup('env', 'PROXMOX_VM_IP') }}"
github¶
Purpose: CI testing in GitHub Actions
Platform: Ubuntu containers in GitHub runners Duration: 5-10 minutes Use case: Automated PR testing
Command:
Triggered by: - Push to main/dev branches - Pull requests - Manual workflow dispatch
Configuration:
# .github/workflows/molecule.yml
name: Molecule CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Molecule
run: molecule test -s github
Scenario Selection Guide¶
When to Use Each Scenario¶
default: - ✅ Daily development work - ✅ Quick sanity checks - ✅ Testing specific code changes - ❌ Not for final validation
podman: - ✅ Pre-commit testing - ✅ Multi-distro compatibility - ✅ Local comprehensive testing - ❌ Not for production validation
proxmox: - ✅ Integration testing - ✅ Performance testing - ✅ Production validation - ❌ Not for rapid iteration
github: - ✅ Automated CI/CD - ✅ PR validation - ✅ Regression testing - ❌ Not for local development
Scenario Comparison¶
| Scenario | Speed | Platforms | Isolation | CI-Ready | Cost |
|---|---|---|---|---|---|
| default | ⚡⚡⚡ | 1 | Medium | ✅ | Free |
| podman | ⚡⚡ | 3 | Medium | ✅ | Free |
| proxmox | ⚡ | Varies | High | ⚠️ | Infrastructure |
| github | ⚡⚡ | 1-3 | High | ✅ | Free (public) |
Custom Scenarios¶
Creating New Scenarios¶
Directory structure:
molecule/custom_scenario/
├── molecule.yml # Scenario configuration
├── converge.yml # Test playbook
├── verify.yml # Verification tasks
└── prepare.yml # Optional setup
Example: S3 Storage Testing¶
# molecule/s3-test/molecule.yml
---
driver:
name: podman
platforms:
- name: influxdb-s3
image: debian:12
systemd: true
- name: minio
image: minio/minio
command: server /data
published_ports:
- "9000:9000"
env:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
provisioner:
name: ansible
inventory:
host_vars:
influxdb-s3:
influxdb_s3_enabled: true
influxdb_s3_endpoint: "http://minio:9000"
influxdb_s3_bucket: "test-influxdb"
influxdb_s3_access_key: "minioadmin"
influxdb_s3_secret_key: "minioadmin"
Example: High Availability Testing¶
# molecule/ha-test/molecule.yml
platforms:
- name: influxdb-1
image: debian:12
systemd: true
groups:
- influxdb_cluster
- name: influxdb-2
image: debian:12
systemd: true
groups:
- influxdb_cluster
provisioner:
inventory:
group_vars:
influxdb_cluster:
influxdb_cluster_mode: true
influxdb_peers:
- influxdb-1
- influxdb-2
Scenario Variables¶
Environment Variables¶
# Set scenario-specific variables
export MOLECULE_DISTRO="debian:12"
export MOLECULE_SCENARIO="podman"
export MOLECULE_SECURE_LOGGING="false"
molecule test
Molecule Configuration¶
# molecule.yml - Use environment variables
platforms:
- name: instance
image: ${MOLECULE_DISTRO:-debian:12}
provisioner:
inventory:
host_vars:
instance:
secure_logging: ${MOLECULE_SECURE_LOGGING:-true}
Running Multiple Scenarios¶
Sequential¶
# Run all scenarios one by one
for scenario in default podman proxmox; do
molecule test -s $scenario
done
Parallel¶
Selective¶
# Only run fast scenarios
molecule test -s default
molecule test -s podman
# Skip slow scenarios for quick feedback
# molecule test -s proxmox # Commented out
Scenario Inheritance¶
Base Configuration¶
# molecule/base/molecule.yml
dependency:
name: galaxy
provisioner:
name: ansible
log: true
options:
v: true
verifier:
name: ansible
Inherit in Specific Scenarios¶
# molecule/podman/molecule.yml
extends: ../base/molecule.yml
driver:
name: podman
platforms:
- name: debian12
image: debian:12
Debugging Scenarios¶
Show Available Scenarios¶
Output:
Instance Name Driver Name Provisioner Name Scenario Name Created Converged
--------------- ------------- ------------------ --------------- --------- -----------
debian12 podman ansible default false false
debian12 podman ansible podman false false
test-vm delegated ansible proxmox false false
Test Specific Platform¶
Inspect Scenario Config¶
# Show effective configuration
molecule config -s podman
# Validate configuration
molecule syntax -s podman
Best Practices¶
1. Start with default¶
Always test with default scenario first before running comprehensive tests.
2. Use podman for pre-commit¶
Run molecule test -s podman before committing to catch multi-platform issues.
3. Reserve proxmox for integration¶
Only use Proxmox scenario for: - Final validation before release - Integration testing - Performance testing
4. Automate github scenario¶
Let CI run GitHub scenario automatically on PRs.
5. Keep scenarios focused¶
Each scenario should test specific aspects: - default: Basic functionality - podman: Multi-platform compatibility - s3-test: Storage backends - ha-test: Clustering
Scenario Maintenance¶
Updating Scenarios¶
# Update platform images
# Edit molecule.yml
platforms:
- name: debian12
image: debian:12 # Update to debian:13 when available
Cleaning Up Scenarios¶
# Remove old scenario instances
molecule destroy -s old_scenario
# Remove scenario entirely
rm -rf molecule/old_scenario
Documentation¶
Document each scenario's purpose in README:
## Test Scenarios
- **default:** Quick local testing (Debian 12)
- **podman:** Multi-distro (Debian 12, Rocky 9, Ubuntu 24)
- **proxmox:** VM integration testing
- **s3-test:** S3 storage backend testing
Next Steps¶
- Platform Matrix: Testing across distributions
- CI/CD Integration: Automating scenario execution
- Verification Tasks: Writing effective tests