- Environment-split settings: base/local/test/prod with django-environ - Postgres + Redis + Celery wiring (broker, beat, result backend) - All 9 domain app stubs: accounts, courses, cms, tracking, quizzes, training, certificates, reports, notifications - api app: /healthz/ endpoint, custom DRF exception handler, SecurityAuditMiddleware, permissions/throttle/upload-validation stubs - DRF global baseline: JWT+session auth, closed-by-default permissions, cursor/page pagination, drf-spectacular schema generation - Dockerfile (multi-env build arg), docker-compose.yml (local), docker-compose.test.yml (CI-friendly tmpfs Postgres) - pytest.ini with smoke + settings marker definitions - tests/test_smoke.py: startup, URL resolution, healthcheck shape - tests/test_settings_matrix.py: per-profile security assertions - .github/workflows/ci.yml: test, lint, schema CI jobs - .env.example with all required vars documented - .gitignore Co-Authored-By: Paperclip <noreply@paperclip.ing>
53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
db-test:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: training_test
|
|
POSTGRES_USER: training
|
|
POSTGRES_PASSWORD: training
|
|
ports:
|
|
- "5433:5432"
|
|
tmpfs:
|
|
- /var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U training"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
redis-test:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6380:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
test:
|
|
build:
|
|
context: .
|
|
args:
|
|
REQUIREMENTS_FILE: test.txt
|
|
command: >
|
|
sh -c "
|
|
python manage.py migrate --settings=config.settings.test &&
|
|
pytest --cov=. --cov-report=term-missing -v
|
|
"
|
|
volumes:
|
|
- .:/app
|
|
environment:
|
|
DJANGO_SETTINGS_MODULE: config.settings.test
|
|
DATABASE_URL: postgres://training:training@db-test:5432/training_test
|
|
REDIS_URL: redis://redis-test:6379/0
|
|
DJANGO_SECRET_KEY: test-secret-key-not-for-production
|
|
DJANGO_ALLOWED_HOSTS: testserver,localhost
|
|
depends_on:
|
|
db-test:
|
|
condition: service_healthy
|
|
redis-test:
|
|
condition: service_healthy
|