Files
meshcore-hub/tests/e2e/docker-compose.test.yml
Louis King e6b3ceb639 Updates
2025-12-03 17:02:57 +00:00

137 lines
3.3 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:
- ../../etc/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: 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: 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: 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: 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