Files
meshcore-hub/tests/e2e/docker-compose.test.yml
Claude 50a3b5be19 Complete Phase 6: Docker deployment and CI/CD
Health Checks (6.3):
- Add is_healthy property and get_health_status() to Receiver/Sender
- Add is_healthy property and get_health_status() to Collector Subscriber
- Track device, MQTT, and database connection status

Documentation (6.5):
- Update README with Docker Compose profiles documentation
- Add serial device access instructions
- Update API documentation URLs and add health check info

CI/CD (6.6):
- Add .github/workflows/ci.yml for linting, testing, and building
- Add .github/workflows/docker.yml for Docker image builds
- Support Python 3.11 and 3.12 in CI matrix
- Configure Codecov for coverage reporting

End-to-End Testing (6.7):
- Add tests/e2e/ directory with Docker Compose test configuration
- Add e2e test fixtures with service health waiting
- Add comprehensive e2e tests for API, Web, and auth flows
2025-12-03 15:38:02 +00:00

137 lines
3.4 KiB
YAML

# MeshCore Hub - End-to-End Test Docker Compose
#
# This configuration runs all services with a mock device for integration testing.
#
# Usage:
# docker compose -f tests/e2e/docker-compose.test.yml up -d
# pytest tests/e2e/
# docker compose -f tests/e2e/docker-compose.test.yml down -v
services:
# MQTT Broker
mqtt:
image: eclipse-mosquitto:2
container_name: meshcore-test-mqtt
ports:
- "11883:1883"
volumes:
- ../../docker/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
healthcheck:
test: ["CMD", "mosquitto_sub", "-t", "$$SYS/#", "-C", "1", "-i", "healthcheck", "-W", "3"]
interval: 5s
timeout: 5s
retries: 3
start_period: 5s
# Interface with mock device
interface-mock:
build:
context: ../..
dockerfile: docker/Dockerfile
container_name: meshcore-test-interface
depends_on:
mqtt:
condition: service_healthy
environment:
- LOG_LEVEL=DEBUG
- MQTT_HOST=mqtt
- MQTT_PORT=1883
- MQTT_PREFIX=test
- MOCK_DEVICE=true
- NODE_ADDRESS=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
command: ["interface", "receiver", "--mock"]
healthcheck:
test: ["CMD", "pgrep", "-f", "meshcore-hub"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
# Collector
collector:
build:
context: ../..
dockerfile: docker/Dockerfile
container_name: meshcore-test-collector
depends_on:
mqtt:
condition: service_healthy
volumes:
- test_data:/data
environment:
- LOG_LEVEL=DEBUG
- MQTT_HOST=mqtt
- MQTT_PORT=1883
- MQTT_PREFIX=test
- DATABASE_URL=sqlite:////data/test.db
command: ["collector"]
healthcheck:
test: ["CMD", "pgrep", "-f", "meshcore-hub"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
# API Server
api:
build:
context: ../..
dockerfile: docker/Dockerfile
container_name: meshcore-test-api
depends_on:
mqtt:
condition: service_healthy
collector:
condition: service_started
ports:
- "18000:8000"
volumes:
- test_data:/data
environment:
- LOG_LEVEL=DEBUG
- MQTT_HOST=mqtt
- MQTT_PORT=1883
- MQTT_PREFIX=test
- DATABASE_URL=sqlite:////data/test.db
- API_HOST=0.0.0.0
- API_PORT=8000
- API_READ_KEY=test-read-key
- API_ADMIN_KEY=test-admin-key
command: ["api"]
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
# Web Dashboard
web:
build:
context: ../..
dockerfile: docker/Dockerfile
container_name: meshcore-test-web
depends_on:
api:
condition: service_healthy
ports:
- "18080:8080"
environment:
- LOG_LEVEL=DEBUG
- API_BASE_URL=http://api:8000
- API_KEY=test-read-key
- WEB_HOST=0.0.0.0
- WEB_PORT=8080
- NETWORK_NAME=Test Network
command: ["web"]
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
volumes:
test_data:
name: meshcore_test_data