kankwa/docker-compose.test.yml

36 lines
1.1 KiB
YAML

name: kankwa-test
services:
db-test:
image: postgres:16-alpine
environment:
POSTGRES_USER: kankwa_test
POSTGRES_PASSWORD: kankwa_test_password
POSTGRES_DB: kankwa_test
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
command: postgres -c password_encryption=scram-sha-256
healthcheck:
test: ["CMD-SHELL", "pg_isready -U kankwa_test -d kankwa_test"]
interval: 2s
timeout: 3s
retries: 20
tmpfs:
- /var/lib/postgresql/data
tests:
build: .
environment:
DATABASE_URL: postgresql+asyncpg://kankwa_test:kankwa_test_password@db-test:5432/kankwa_test
SECRET_KEY: test-only-secret-key-not-for-production
ENVIRONMENT: test
FRONTEND_URL: http://testserver
PYTHONDONTWRITEBYTECODE: "1"
HOME: /tmp
PATH: /tmp/.local/bin:$PATH
depends_on:
db-test:
condition: service_healthy
command: >-
sh -c "python -m pip install --no-cache-dir --user -r requirements-dev.txt &&
python -m alembic upgrade head &&
python -m pytest -q -p no:cacheprovider tests"