Skip to content

v4.9 - 🧪 E2E Testing

Choose a tag to compare

@m4r1k m4r1k released this 06 Jan 11:09

Eneru now includes a full end-to-end test suite that validates the complete monitoring and shutdown workflow using real services—on every commit.


🚀 What's New

Added

  • End-to-End (E2E) Test Suite: Comprehensive E2E testing infrastructure with real services

    • NUT server with dummy driver for UPS state simulation (8 scenarios)
    • SSH target container for remote shutdown command verification
    • Docker Compose test environment for local and CI testing
    • 7 automated tests covering config validation, power failure detection, SSH shutdown, FSD triggers, voltage events, and notifications
    • New GitHub Actions workflow (.github/workflows/e2e.yml) runs on every push/PR
  • --exit-after-shutdown CLI Flag: Exit after completing shutdown sequence instead of continuing to monitor

    • Useful for E2E testing and scripting scenarios
    • Enables clean test completion in CI environments

🐛 Fixed

  • Dry-run Mode: Wall broadcast messages are now skipped in dry-run mode to avoid false alerts during testing

E2E Test Scenarios

The E2E suite simulates 8 different UPS states:

Scenario Description Triggers Shutdown?
online-charging Normal operation, fully charged No
on-battery On battery, battery OK No
low-battery Battery below 20% threshold Yes
critical-runtime Runtime below 600s threshold Yes
fsd UPS signals Forced Shutdown Yes
avr-boost AVR boosting low voltage No
brownout Voltage below warning threshold No
overload UPS overloaded No

Run E2E Tests Locally

cd tests/e2e

# Generate SSH keys
ssh-keygen -t ed25519 -f /tmp/e2e-ssh-key -N ""
cp /tmp/e2e-ssh-key.pub ssh-target/authorized_keys

# Start test environment
docker compose up -d --build

# Simulate power failure
cp scenarios/low-battery.dev scenarios/apply.dev
eneru --config config-e2e-dry-run.yaml --exit-after-shutdown

# Cleanup
docker compose down -v

Testing Confidence

Every commit now triggers:

  • 190 unit tests across 6 Python versions (3.9-3.14)
  • Integration tests on 7 Linux distributions (Debian 12/13, Ubuntu 24.04/26.04, RHEL 8/9/10)
  • E2E tests with real NUT server, SSH target, and Docker containers

📚 Documentation


📋 Full Changelog

Full Changelog: v4.8...v4.9