Skip to content

test(relay): skip 2 PG-dependent admin report/feedback 404 tests when BUZZ_TEST_DATABASE_URL unset #4083

Description

@iroiro147

Summary

crates/buzz-relay/src/api/admin/mod.rs has two PG-dependent integration tests in mod tests that fail hard when run without a live Postgres, mirroring the exact problem tracked in #4080 for api::media::tests:

  • admin::tests::report_detail_rejects_unknown_report — calls test_state() (which eagerly seeds a community via ensure_configured_community, panicking if BUZZ_DATABASE_URL is unset), then asserts a 404 for /reports/{nil-uuid} on the admin host.
  • admin::tests::feedback_attachment_rejects_unknown_feedback — same shape, asserts 404 for /feedback/{nil-uuid}/attachments/{hash}.

Both currently fail with a 500 (from a dead PoolTimedOut / connect error surfaced as S3Error-style 500, not the application-level ApiError::not_found) whenever cargo test -p buzz-relay runs in an environment where BUZZ_TEST_DATABASE_URL is not pointing at a live Postgres.

Sibling tests in the same module that assert 403 (admin-host gate, before any DB access) continue to pass — these two are the only ones post-authorize DB call.

Proposed fix

Apply the same #[ignore = "requires a live Postgres: set BUZZ_TEST_DATABASE_URL"] attribute pattern used in crates/buzz-search/tests/fts_integration.rs and already applied to api::media::tests for #4080. Then cargo test -p buzz-relay passes cleanly in PG-less environments and developers opt back into the live-Postgres surface with:

BUZZ_TEST_DATABASE_URL=postgres://buzz:buzz_dev@localhost:5432/buzz \
  cargo test -p buzz-relay -- --include-ignored

Follow-up (out of scope)

Refactoring test_state() to stop eagerly seeding a community (the same DX problem called out in #4080) would let even more admin tests run without PG.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions