mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
###############################################################################
|
|
# Test infrastructure - run with:
|
|
# docker compose -f docker/docker-compose.test.yml up --build --abort-on-container-exit
|
|
###############################################################################
|
|
name: snapotter-test
|
|
services:
|
|
# ── Unit + Integration tests ─────────────────────────────────────────────
|
|
test-unit:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile.test
|
|
container_name: SnapOtter-test-unit
|
|
command: ["pnpm", "test:ci"]
|
|
environment:
|
|
- NODE_ENV=test
|
|
- AUTH_ENABLED=true
|
|
- DEFAULT_USERNAME=admin
|
|
- DEFAULT_PASSWORD=admin
|
|
- DATABASE_URL=postgres://snapotter:snapotter@postgres:5432/snapotter_test
|
|
# Tells tests/global-setup.ts to use these servers instead of spawning
|
|
# testcontainers (no docker daemon inside the test container).
|
|
- TEST_DATABASE_URL=postgres://snapotter:snapotter@postgres:5432/snapotter_test
|
|
- TEST_REDIS_URL=redis://redis:6379
|
|
- REDIS_URL=redis://redis:6379
|
|
- WORKSPACE_PATH=/tmp/test-workspace
|
|
- MAX_MEGAPIXELS=100
|
|
- RATE_LIMIT_PER_MIN=1000
|
|
tmpfs:
|
|
- /tmp/test-workspace
|
|
- /tmp
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
# ── E2E tests (Playwright against full app) ─────────────────────────────
|
|
test-e2e:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile.test
|
|
container_name: SnapOtter-test-e2e
|
|
# Visual project is excluded: linux baselines are managed by the
|
|
# update-visual-baselines workflow, not generated inside the container.
|
|
command:
|
|
[
|
|
"sh",
|
|
"-c",
|
|
"npx playwright install --with-deps chromium && pnpm playwright test --project=chromium && pnpm playwright test --project=chromium-serial --workers=1",
|
|
]
|
|
environment:
|
|
- NODE_ENV=test
|
|
- AUTH_ENABLED=true
|
|
- DEFAULT_USERNAME=admin
|
|
- DEFAULT_PASSWORD=admin
|
|
- DATABASE_URL=postgres://snapotter:snapotter@postgres:5432/snapotter_test
|
|
- REDIS_URL=redis://redis:6379
|
|
- WORKSPACE_PATH=/tmp/test-workspace
|
|
- MAX_MEGAPIXELS=100
|
|
- RATE_LIMIT_PER_MIN=1000
|
|
- CI=true
|
|
tmpfs:
|
|
- /tmp/test-workspace
|
|
- /tmp
|
|
depends_on:
|
|
test-unit:
|
|
condition: service_completed_successfully
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
container_name: SnapOtter-test-postgres
|
|
environment:
|
|
POSTGRES_USER: snapotter
|
|
POSTGRES_PASSWORD: snapotter
|
|
POSTGRES_DB: snapotter_test
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U snapotter"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 15s
|
|
tmpfs:
|
|
- /var/lib/postgresql/data
|
|
|
|
redis:
|
|
image: redis:8-alpine
|
|
container_name: SnapOtter-test-redis
|
|
command: ["redis-server", "--maxmemory-policy", "noeviction", "--appendonly", "no"]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 10s
|
|
tmpfs:
|
|
- /data
|