This directory contains end-to-end tests for the Cyber Ware example server.
- Python 3.9+ is required.
- E2E tests must run on Python 3.9 and above.
Install Python dependencies:
pip install -r testing/e2e/requirements.txtThe scripts/ci.py Python script supports two modes: local (default) and Docker.
This approach builds a Docker image and runs tests in an isolated environment:
# Using make
make e2e-docker # all tests
make e2e-docker-smoke # smoke only tests (annotated with @pytest.mark.smoke)
# Or directly
python3 scripts/ci.py e2e-dockerThis approach runs tests against a locally running cyberware-server.
scripts/ci.py e2e-local will build and start the local server automatically.
# Run local E2E (builds release artifacts and starts server automatically)
make e2e-local # all tests
make e2e-local-smoke # smoke only tests (annotated with @pytest.mark.smoke)
# Or directly
python3 scripts/ci.py e2e-localEnvironment Variables:
E2E_BASE_URL: Base URL for the API (default:http://localhost:8086) - only used in local modeE2E_AUTH_TOKEN: Optional authentication token for protected endpoints
Why local E2E defaults to 8086:
- Local E2E uses
config/e2e-local.yamland a dedicated E2E-oriented build/run path, which may differ from the usual development default (8087viaquickstart). - Keeping a stable, dedicated E2E port makes lifecycle management deterministic:
scripts/ci.pycan reliably start, health-check, and stop the service it launched. - This also makes it safer to kill/restart only the E2E-owned process during test runs, without interfering with another manually started server.
# Run the server in one terminal:
make quickstart
# Run the tests in another terminal:
E2E_BASE_URL=http://localhost:8087 python3 -m pytest testing/e2e/modules/nodes_registry
# or for smoke tests only:
E2E_BASE_URL=http://localhost:8087 python3 -m pytest testing/e2e/modules/nodes_registry -m smokeE2E_BASE_URL=http://localhost:8087 E2E_AUTH_TOKEN=your-token python3 -m pytest testing/e2e/The scripts/ci.py Python script accepts the following options:
--docker: Run tests in Docker environment (default is local mode)--smoke: Run only tests marked with@pytest.mark.smoke--help: Show help message
For philosophy, patterns, anti-flaking practices, and assert guidelines see the unified guide:
docs/modkit_unified_system/13_e2e_testing.md
Tests are written using pytest and httpx. See modules/file_parser/test_file_parser_info.py for an example.
Key fixtures available:
base_url: Returns the base URL fromE2E_BASE_URLenvironment variableauth_headers: Returns authorization headers ifE2E_AUTH_TOKENis setlocal_files_root: Returns the root directory for local file parsing testsfile_http_server: Starts a local HTTP server serving files frome2e/testdata
Example:
import httpx
import pytest
@pytest.mark.asyncio
async def test_my_endpoint(base_url, auth_headers):
async with httpx.AsyncClient(timeout=10.0) as client:
response = await client.get(
f"{base_url}/my-endpoint",
headers=auth_headers,
)
assert response.status_code == 200| Command | Mode | Description |
|---|---|---|
make e2e |
Docker | Default: Run tests in Docker |
make e2e-docker |
Docker | Run tests in Docker environment |
make e2e-docker-smoke |
Docker | Run only smoke tests in Docker |
make e2e-local |
Local | Run tests against auto-started local server |
make e2e-local-smoke |
Local | Run only smoke tests locally |
python3 scripts/ci.py e2e-local |
Local | Direct script execution (local) |
python3 scripts/ci.py e2e-local --smoke |
Local | Direct script execution (smoke only) |
python3 scripts/ci.py e2e-docker |
Docker | Direct script execution (Docker) |
If you see "Server not responding" when running local tests:
- Check build/startup logs in
logs/cybeware-e2e.logandlogs/cybeware-e2e-error.log - Check that the API is reachable on the configured port (default: 8086)
- Verify the health endpoint:
curl http://localhost:8086/healthz - Rebuild release artifacts:
make build - Or use Docker mode:
make e2e-docker
Install the required dependencies:
pip install -r testing/e2e/requirements.txtMake sure Docker is running and you have sufficient disk space:
docker system df
docker system prune # if needed