test: the DLQ repository tests delete the rows they insert

Merged
HA
16h ago
+23-13

Summary

Small bug found while checking the DLQ span metrics. Two tests in test_dlq_repository.py insert DLQ rows on topics t1 and t2 and never delete them. After one e2e run the shared database kept 6 of them, so the worker's DLQ size job reports t1 = 3 and t2 = 1 until the 7-day TTL runs out.

Changes

The inserts become fixtures that yield and then delete their rows by event id, the way failed_event in tests/e2e/dlq/test_dlq_manager.py already does.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (./deploy.sh openapi, then ./deploy.sh types), never edited by hand
  • Manual testing performed

Validation: ruff and mypy --strict pass; the Backend E2E job runs both tests against the real stack.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings

Summary by cubic

Fixes the DLQ repository e2e tests leaving inserted rows behind, which inflated the worker's DLQ size job metrics for topics t1 and t2 until the 7-day TTL expired.

  • Converts the test row inserts into fixtures that delete their rows by event id after each test finishes.
  • Follows the same cleanup pattern already used in test_dlq_manager.py.