# AI-Service Tests Tests covering the AI provider intermediary (`ai-service:8010`): health, provider configuration, synchronous chat, the priority queue (enqueue/poll/cancel/pause/resume), and provider timeout. Full combined suite: `tests/ALL_TESTS.md` **Test environment:** Feature stack at `http://localhost:$PORT` (see CLAUDE.md §Feature branch workflow). **Admin credentials:** any superuser account created during stack setup. --- ## Legend | Symbol | Meaning | |--------|---------| | ✅ | Pass | | ❌ | Fail | | — | N/A for this change | --- ## 17. AI Service — Queue & Providers | # | Test | Steps | Expected | |---|------|-------|----------| | 17.1 | Health check | `GET /health` on ai-service (via backend services endpoint) | `{"status": "ok"}` | | 17.2 | Provider health | `GET /health/provider` | Active provider name, model, configured=true | | 17.3 | Unconfigured provider | Set provider to "anthropic" with empty API key → test connection | 503 or 502 with clear error | | 17.4 | Sync chat | `POST /chat` with valid messages array | Response returned synchronously | | 17.5 | Queue — async job | `POST /queue/jobs` | `job_id` returned immediately | | 17.6 | Queue — poll job | `GET /queue/jobs/{id}` after enqueue | Returns status (`pending` → `done`) and result | | 17.7 | Queue — cancel job | `DELETE /queue/jobs/{id}` before processing | Job removed; status = cancelled | | 17.8 | Queue pause | `POST /queue/pause` | 204; current job finishes; no new jobs picked up | | 17.9 | Queue resume | `POST /queue/resume` after pause | 204; worker resumes; pending jobs process | | 17.10 | Priority ordering | Enqueue LOW then HIGH job | HIGH job processed first | | 17.11 | Provider timeout | `POST /chat` when provider is unreachable | 504 returned after timeout |