95 lines
2.4 KiB
YAML
95 lines
2.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Test database - separate from development
|
|
test-db:
|
|
image: postgres:15
|
|
environment:
|
|
POSTGRES_DB: vip_coordinator_test
|
|
POSTGRES_USER: test_user
|
|
POSTGRES_PASSWORD: test_password
|
|
ports:
|
|
- 5433:5432 # Different port to avoid conflicts
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U test_user"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
tmpfs:
|
|
- /var/lib/postgresql/data # Use memory for faster tests
|
|
|
|
# Test Redis - separate instance
|
|
test-redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6380:6379 # Different port to avoid conflicts
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Backend test runner
|
|
backend-test:
|
|
build:
|
|
context: ./backend
|
|
target: development
|
|
environment:
|
|
NODE_ENV: test
|
|
DATABASE_URL: postgresql://test_user:test_password@test-db:5432/vip_coordinator_test
|
|
REDIS_URL: redis://test-redis:6379
|
|
GOOGLE_CLIENT_ID: test_google_client_id
|
|
GOOGLE_CLIENT_SECRET: test_google_client_secret
|
|
GOOGLE_REDIRECT_URI: http://localhost:3000/auth/google/callback
|
|
FRONTEND_URL: http://localhost:5173
|
|
JWT_SECRET: test_jwt_secret_minimum_32_characters_long
|
|
TEST_DB_HOST: test-db
|
|
TEST_DB_PORT: 5432
|
|
TEST_DB_USER: test_user
|
|
TEST_DB_PASSWORD: test_password
|
|
TEST_DB_NAME: vip_coordinator_test
|
|
TEST_REDIS_URL: redis://test-redis:6379
|
|
depends_on:
|
|
test-db:
|
|
condition: service_healthy
|
|
test-redis:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./backend:/app
|
|
- /app/node_modules
|
|
command: npm test
|
|
|
|
# Frontend test runner
|
|
frontend-test:
|
|
build:
|
|
context: ./frontend
|
|
target: development
|
|
environment:
|
|
NODE_ENV: test
|
|
VITE_API_URL: http://backend-test:3000/api
|
|
VITE_GOOGLE_CLIENT_ID: test_google_client_id
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
command: npm test
|
|
|
|
# E2E test runner (Playwright)
|
|
e2e-test:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.e2e
|
|
environment:
|
|
PLAYWRIGHT_BASE_URL: http://frontend:80
|
|
PLAYWRIGHT_API_URL: http://backend:3000
|
|
depends_on:
|
|
- backend
|
|
- frontend
|
|
volumes:
|
|
- ./e2e:/app/e2e
|
|
- ./e2e/results:/app/e2e/results
|
|
command: npx playwright test
|
|
|
|
# Networks
|
|
networks:
|
|
default:
|
|
name: vip-test-network |