Files
leocrm/test_report.md
T
Agent Zero 07a99975ec Phase 5: Outbox DLQ, Monitoring, Consumer-Registry
- Migration 0092: DLQ columns (error_message, failed_at) + consumer_inbox RLS fix
- outbox.py: DLQ logic, replay functions, stats, consumer registry
- app/routes/outbox.py: 5 API endpoints (stats, failed, replay, replay-all, consumer-registry)
- outbox_deliveries tracking per consumer handler
- 18/18 tests passing
2026-08-02 23:25:54 +02:00

48 lines
2.0 KiB
Markdown

# Test Report — Phase 5: Outbox DLQ, Monitoring, Consumer-Registry
## Date: 2026-08-02
## Test Execution
```
cd /a0/usr/workdir/leocrm-fix && python -m pytest tests/test_outbox.py tests/test_outbox_phase5.py -v
```
## Results: 18 passed, 0 failed
### Existing Tests (test_outbox.py) — 6/6 passed
- test_enqueue_outbox_event_inserts_pending_row ✅
- test_process_outbox_batch_publishes_events ✅
- test_process_outbox_batch_empty_returns_zero ✅
- test_process_outbox_batch_retry_on_failure ✅
- test_process_outbox_batch_max_attempts_marks_failed ✅
- test_enqueue_multiple_events_and_batch_size ✅
### Phase 5 Tests (test_outbox_phase5.py) — 12/12 passed
- test_failed_event_has_error_message ✅ (DLQ: error_message + failed_at set)
- test_replay_failed_event ✅ (single replay: failed→pending)
- test_replay_failed_event_not_found ✅ (404 case)
- test_replay_all_failed_events ✅ (bulk replay: 3 events reset)
- test_get_outbox_stats ✅ (counts per status, total, oldest pending age)
- test_get_outbox_stats_empty ✅ (empty tenant returns zeros)
- test_get_failed_events ✅ (failed events with error details)
- test_get_failed_events_pagination ✅ (limit/offset pagination)
- test_get_consumer_registry ✅ (event_name→handler_names mapping)
- test_outbox_deliveries_written_on_success ✅ (status='delivered')
- test_outbox_deliveries_written_on_failure ✅ (status='failed', last_error set)
- test_route_import ✅ (all 5 endpoints registered)
## Syntax Check
```
python -c 'import app.core.outbox; import app.routes.outbox; import app.models.outbox; import app.models.consumer_inbox; import app.models.outbox_delivery'
→ All imports OK
```
## Smoke Test
- All 5 API endpoints registered under `/api/v1/outbox/`
- DLQ columns (error_message, failed_at) functional in event_outbox
- Replay functions reset failed events to pending correctly
- outbox_deliveries entries written per-consumer during processing
- Consumer registry reads from event_bus._handlers at runtime
- RLS: tenant context required for all monitoring queries