This commit is contained in:
2026-03-18 17:30:13 +01:00
parent 58a233236c
commit d80d912fb3
36 changed files with 3502 additions and 4 deletions
+35
View File
@@ -38,6 +38,9 @@ logs: ## Segui i log di tutti i servizi
logs-backend: ## Segui i log del backend
$(COMPOSE) logs -f backend
logs-worker: ## Segui i log del worker IMAP
$(COMPOSE) logs -f worker
ps: ## Stato dei container
$(COMPOSE) ps
@@ -80,6 +83,38 @@ test-integration: ## Solo integration test
test-cov: ## Test con coverage report
$(PYTEST) --cov=app --cov-report=term-missing --cov-report=html:/app/htmlcov -v
# ─── Worker ──────────────────────────────────────────────────────────────────
WORKER = $(COMPOSE) exec worker
PYTEST_WORKER = $(WORKER) python -m pytest
test-worker: ## Esegui tutti i test del worker
$(PYTEST_WORKER) -v --tb=short
test-worker-unit: ## Solo unit test del worker (no infra richiesta)
$(PYTEST_WORKER) tests/unit -v
test-imap: ## Test integrazione IMAP con GreenMail (avvia GreenMail prima)
$(PYTEST_WORKER) tests/integration -v
greenmail-up: ## Avvia GreenMail (server IMAP/SMTP mock per test)
$(COMPOSE) --profile greenmail up -d greenmail
@echo " ✅ GreenMail avviato:"
@echo " 📬 IMAP: localhost:3143"
@echo " 📨 SMTP: localhost:3025"
@echo " 🌐 API: http://localhost:8080"
greenmail-down: ## Ferma GreenMail
$(COMPOSE) --profile greenmail stop greenmail
shell-worker: ## Shell nel container worker
$(WORKER) bash
worker-health: ## Verifica health del worker (tramite arq job)
$(WORKER) python -c "import asyncio; from arq import create_pool; from arq.connections import RedisSettings; \
async def main(): pool = await create_pool(RedisSettings()); r = await pool.enqueue_job('health_check'); print(await r.result(timeout=10)); \
asyncio.run(main())"
# ─── Code quality ─────────────────────────────────────────────────────────────
lint: ## Esegui linting (ruff + mypy)