Skip to content

24. Testing

Developer Guide

This page provides a high-level overview. For detailed guidance on adding tests for new services, see Adding Service Tests.

24.1 Running Tests Locally

./tests/test.sh

The test suite includes tests across five categories:

  • Validation Tests: Input validation and security testing
  • Smoke Tests: Quick sanity checks (Docker build, required components)
  • Unit Tests: Configuration and environment variable handling (including security validation)
  • Integration Tests: Container startup with various service combinations
  • Functional Tests: End-to-end RTMP streaming, archiving, and authorization

24.2 Test Philosophy

All tests follow fail-fast principles with automatic cleanup. Tests are designed to:

  1. Validate security: Reject malicious inputs (command injection, path traversal)
  2. Verify configuration: Ensure services enable/disable correctly
  3. Check integration: Confirm container startup with various combinations
  4. Test functionality: Validate end-to-end streaming workflows

24.3 Running Individual Test Suites

Individual test suites can be run separately:

bash tests/00_validation_tests.sh  # Validation tests
bash tests/01_smoke_tests.sh      # Smoke tests
bash tests/02_unit_tests.sh       # Unit tests
bash tests/03_integration_tests.sh # Integration tests
bash tests/04_functional_tests.sh  # Functional tests (requires ffmpeg)

Tests automatically clean up containers and temporary files. Exit code 0 = all passed, 1 = failures.

24.4 CI/CD

GitHub Actions automatically runs all test suites on every push and PR via .github/workflows/ci.yml. Each test type runs as a separate job:

  • Smoke Tests (runs first)
  • Unit Tests (after smoke tests pass)
  • Integration Tests (after smoke tests pass)
  • Functional Tests (after smoke tests pass)

For more detailed testing documentation, see tests/README.md in the repository.