/claim #677

Fixes Issue

Closes #677

Changes proposed

This PR implements a robust End-to-End (E2E) testing framework for OPAL using PyTest and Docker, following the approved Implementation Plan. It also includes critical infrastructure fixes to ensure stability and cross-platform compatibility.

Phase 1: Setup E2E Test Environment

  • Dedicated Directory: Created e2e-tests/ containing all test infrastructure.
  • Docker Configuration:
    • Created e2e-tests/docker-compose.yml defining opal_server, opal_client, and broadcast_channel.
    • Simplified environment variables for isolated testing.
    • Integrated wait-for.sh to properly synchronize client startup with the server.
  • PyTest Structure:
    • Initialized requirements.txt with necessary dependencies (pytest, requests, pytest-docker).
    • Implemented conftest.py fixtures to manage Docker service lifecycles and provide base URLs with readiness checks.

Phase 2: Implement Core E2E Tests

  • Health Check Tests: Implemented TestHealthChecks to assert 200 OK on /health endpoints for Server, Client, and the embedded OPA instance.
  • Connection Verification: Implemented TestConnectivity to verify the client-server handshake and data flow by polling the /statistics endpoint.
  • Functional Testing: Added tests for:
    • Policy Operations: Verifying policy bundle updates and OPA queries.
    • Data Synchronization: Validating data updates propagation to OPA.
    • System Reliability: Error handling and recovery scenarios.

Phase 3: Integration and Stability Fixes

  • Makefile Integration: Added a test-e2e target to the root Makefile.
    • Automatically handles virtual environment creation (e2e-tests/.venv) and dependency installation.
    • Fix: Updated syntax to be POSIX-compliant (using . instead of source and python3) to support Linux/WSL environments.
    • Robustness: Added checks to recreate the venv if corrupted.
  • Stability Fixes:
    • Race Condition: Disabled OPAL_STATISTICS_ENABLED in app-tests/docker-compose-app-tests.yml to prevent WebSocket connection drops during the initial handshake under load.
    • Configuration: Fixed JSON formatting for callback configurations in environment variables.

Check List (Check all the applicable boxes) - [x] I sign off on contributing this submission to open-source

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

🎥 Video Demonstration: https://youtu.be/cVuJ3-YHTkU

Note to reviewers

Verification: To run the full E2E suite locally:

make test-e2e

Results:

  • All 21 tests passed successfully (Health, Connectivity, Policy, Data, Reliability).
  • Execution time: ~45s.
  • Verified compatibility with standard Linux/WSL shells.

Claim

Total prize pool $200
Total paid $0
Status Pending
Submitted January 12, 2026
Last updated January 12, 2026

Contributors

MA

Matías J. Magni

@info3

100%

Sponsors

PE

Permit.io

@Permitio

$200