FTL2 Integration Tests
Integration tests for FTL2 modules. Tests run against a real Linode VM — provisions, executes, verifies, tears down.
Status
8/8 passing.
| Module | Status | Duration | Notes |
|---|---|---|---|
| command | passing | ~0.5s | basic execution, creates/removes guards |
| dnf | passing | ~3.0s | install/remove/update packages |
| file | passing | ~0.7s | directory, touch, chmod, symlink, absent, idempotency |
| pip | passing | ~2.0s | install/uninstall Python packages |
| systemd | passing | ~2.5s | start/stop/enable/disable/mask/reload/daemon-reload |
| user | passing | ~1.0s | create/remove/groups/shell |
| authorized_key | passing | ~0.8s | add/remove/exclusive SSH keys |
| firewalld | passing | ~1.5s | service/port/rich_rule/permanent/immediate |
Setup
pip install ftl2
# Set credentials
export LINODE_TOKEN="your-linode-api-token"
export LINODE_ROOT_PASS="test-root-password"Run Tests
# Run all tests
python run_tests.py
# Run a single module test
python run_tests.py systemd
# Run multiple
python run_tests.py systemd firewalld dnfHow It Works
Each test run:
- Provisions a Fedora 42 nanode on Linode (~$0.01/run)
- Runs all selected module tests against it sequentially
- Verifies idempotency (second run returns
changed: false) - Verifies state (shell commands confirm the change took effect)
- Tears down the VM
Tests use FTL2 itself for all steps — provisioning, module execution, verification, and cleanup. This validates both the module and the full execution pipeline (SSH, gate, multiplexing).
Writing Tests
# tests/test_systemd.py
async def test_systemd(ftl, host):
"""Test systemd module."""
# Install a service to test with
await ftl[host].dnf(name="nginx", state="present")
# Test: start and enable
result = await ftl[host].systemd(name="nginx", state="started", enabled=True)
assert result["changed"] == True
# Test: idempotency
result = await ftl[host].systemd(name="nginx", state="started", enabled=True)
assert result["changed"] == False
# Test: verify state
verify = await ftl[host].command(cmd="systemctl is-active nginx")
assert verify["stdout"].strip() == "active"Each test file exports an async def test_<module>(ftl, host) function. The test harness handles VM lifecycle.
License
Apache-2.0