mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
Test Summary: - Build tests: 3 passed (image build, backend imports, static files) - Backend unit tests: 378 passed (9 docker tests excluded) - Frontend unit tests: 137 passed - Integration tests: 9 passed (health, API endpoints, persistence, WebSocket) Changes made to fix the Docker test suite: 1. Added curl to the production Dockerfile for integration tests 2. Removed deprecated version attribute from docker-compose.test.yml 3. Added --pull flag to all build commands to ensure fresh images 4. Added explicit build step before starting integration container 5. Fixed WebSocket test to accept 200 as a valid response 6. Excluded docker-marked tests from backend unit test runs (-m "not docker")
65 lines
1.6 KiB
YAML
65 lines
1.6 KiB
YAML
services:
|
|
# Backend unit tests
|
|
backend-test:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.test
|
|
target: backend-test
|
|
container_name: bambuddy-backend-test
|
|
volumes:
|
|
- ./backend:/app/backend:ro
|
|
environment:
|
|
- TESTING=1
|
|
- PYTHONUNBUFFERED=1
|
|
|
|
# Frontend unit tests
|
|
frontend-test:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.test
|
|
target: frontend-test
|
|
container_name: bambuddy-frontend-test
|
|
volumes:
|
|
- ./frontend/src:/app/frontend/src:ro
|
|
- ./frontend/tests:/app/frontend/tests:ro
|
|
|
|
# Integration test - full application
|
|
integration:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: bambuddy-integration-test
|
|
ports:
|
|
- "8001:8000"
|
|
environment:
|
|
- TESTING=1
|
|
- DATA_DIR=/app/data
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 10s
|
|
volumes:
|
|
- integration_test_data:/app/data
|
|
|
|
# Integration test runner
|
|
integration-test-runner:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.test
|
|
target: backend-test
|
|
container_name: bambuddy-integration-runner
|
|
depends_on:
|
|
integration:
|
|
condition: service_healthy
|
|
environment:
|
|
- BAMBUDDY_TEST_URL=http://integration:8000
|
|
- TESTING=1
|
|
command: ["pytest", "backend/tests/integration/", "-v", "--tb=short", "-m", "docker"]
|
|
volumes:
|
|
- ./backend:/app/backend:ro
|
|
|
|
volumes:
|
|
integration_test_data:
|