Files
headquarter/Makefile
T
Fusion 3ccd94f661 feat: restructure test infrastructure with unit/integration/system separation
Test Organization:
- Create tests/unit/, tests/integration/, tests/system/ directories
- Move existing tests into appropriate categories
- Add pytest markers (@pytest.mark.unit, @pytest.mark.integration)

Shared Fixtures:
- Create conftest.py with SQLite engine (for unit tests)
- Add PostgreSQL session fixture with transaction rollback
- Add TestClient fixture for API tests

Configuration:
- Update pyproject.toml with asyncio_mode=auto
- Add test markers and default addopts
- Add aiosqlite dependency for SQLite support

E2E Testing:
- Initialize Playwright in e2e/ directory
- Add playwright.config.ts
- Create login flow E2E test

Build:
- Add test-unit, test-integration, test-system, test-e2e to Makefile
- Update test target to run all categories
- Add testing documentation to README

Note: Some tests have import issues due to missing python-jose
package in dev environment. This needs to be addressed separately.
2026-05-18 15:00:33 +02:00

115 lines
2.7 KiB
Makefile

.PHONY: help up down logs migrate test test-unit test-integration test-system test-e2e lint clean build
# Default target
help:
@echo "Headquarter Development Commands"
@echo "================================"
@echo "make up - Start all services"
@echo "make down - Stop all services"
@echo "make logs - View service logs"
@echo "make migrate - Run database migrations"
@echo "make test - Run all test suites"
@echo "make test-unit - Run unit tests only"
@echo "make test-integration - Run integration tests only"
@echo "make test-system - Run system tests only"
@echo "make test-e2e - Run E2E tests (Playwright)"
@echo "make lint - Run linting"
@echo "make build - Build all Docker images"
@echo "make clean - Remove containers and volumes"
@echo "make shell - Open shell in API container"
# Start services
up:
docker compose up -d
@echo "Services starting..."
@echo "API: http://localhost:8000"
@echo "Web: http://localhost:3000"
@echo "Postgres: localhost:5432"
@echo "Redis: localhost:6379"
# Stop services
down:
docker compose down
# View logs
logs:
docker compose logs -f
# View specific service logs
logs-api:
docker compose logs -f api
logs-web:
docker compose logs -f web
logs-db:
docker compose logs -f postgres
# Run database migrations
migrate:
docker compose exec api alembic upgrade head
# Create new migration
migration:
docker compose exec api alembic revision --autogenerate -m "$(message)"
# Run all tests
test:
docker compose exec api pytest -v
# Run unit tests only (fast, no external dependencies)
test-unit:
docker compose exec api pytest -v -m unit tests/unit/
# Run integration tests only (requires database)
test-integration:
docker compose exec api pytest -v -m integration tests/integration/
# Run system tests only (full stack)
test-system:
docker compose exec api pytest -v -m system tests/system/
# Run E2E tests (requires full application stack)
test-e2e:
cd e2e && npx playwright test
# Run linting
lint:
docker compose exec api ruff check .
docker compose exec api mypy .
cd apps/web && npm run lint
# Type checking
typecheck:
docker compose exec api mypy .
cd apps/web && npm run typecheck
# Build all images
build:
docker compose build
# Build specific service
build-api:
docker compose build api
build-web:
docker compose build web
# Clean up
clean:
docker compose down -v --remove-orphans
docker system prune -f
# Open shell in API container
shell:
docker compose exec api /bin/sh
# Database shell
db-shell:
docker compose exec postgres psql -U $(POSTGRES_USER) -d $(POSTGRES_DB)
# Health check
health:
@echo "Checking service health..."
@docker compose ps