docker-compose.test.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. services:
  2. # Backend unit tests
  3. backend-test:
  4. build:
  5. context: .
  6. dockerfile: Dockerfile.test
  7. target: backend-test
  8. container_name: bambuddy-backend-test
  9. volumes:
  10. - ./backend:/app/backend:ro
  11. environment:
  12. - TESTING=1
  13. - PYTHONUNBUFFERED=1
  14. # Frontend unit tests
  15. frontend-test:
  16. build:
  17. context: .
  18. dockerfile: Dockerfile.test
  19. target: frontend-test
  20. container_name: bambuddy-frontend-test
  21. volumes:
  22. - ./frontend/src:/app/frontend/src:ro
  23. - ./frontend/tests:/app/frontend/tests:ro
  24. # Integration test - full application
  25. integration:
  26. build:
  27. context: .
  28. dockerfile: Dockerfile
  29. container_name: bambuddy-integration-test
  30. ports:
  31. - "8001:8000"
  32. environment:
  33. - TESTING=1
  34. - DATA_DIR=/app/data
  35. healthcheck:
  36. test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
  37. interval: 5s
  38. timeout: 5s
  39. retries: 10
  40. start_period: 10s
  41. volumes:
  42. - integration_test_data:/app/data
  43. # Integration test runner
  44. integration-test-runner:
  45. build:
  46. context: .
  47. dockerfile: Dockerfile.test
  48. target: backend-test
  49. container_name: bambuddy-integration-runner
  50. depends_on:
  51. integration:
  52. condition: service_healthy
  53. environment:
  54. - BAMBUDDY_TEST_URL=http://integration:8000
  55. - TESTING=1
  56. command: ["pytest", "backend/tests/integration/", "-v", "--tb=short", "-p", "no:cacheprovider", "-n", "30"]
  57. volumes:
  58. - ./backend:/app/backend:ro
  59. volumes:
  60. integration_test_data: