Skip to content

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

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4083-pg-skip-admin-tests-20260802
Open

test(relay): skip 2 PG-dependent admin report/feedback 404 tests when BUZZ_TEST_DATABASE_URL unset#4123
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4083-pg-skip-admin-tests-20260802

Conversation

@iroiro147

Copy link
Copy Markdown

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

Summary

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

  • admin::tests::report_detail_rejects_unknown_report
  • admin::tests::feedback_attachment_rejects_unknown_feedback

Both call test_state() which eagerly seeds a community via ensure_configured_community — panicking when BUZZ_DATABASE_URL is unset (and hitting PoolTimedOut / connect errors when it points at a dead database), surfacing as a 500 rather than the expected 404.

Sibling 403 (admin-host gate) tests continue to pass without Postgres — these two are the only ones that hit the post-authorize DB call.

Fix

Apply the same #[ignore = "requires a live Postgres: set BUZZ_TEST_DATABASE_URL"] attribute pattern used in:

Testing

In a PG-less environment with BUZZ_TEST_DATABASE_URL / BUZZ_DATABASE_URL unset:

cargo test -p buzz-relay --lib admin::tests::
test result: ok. 28 passed; 0 failed; 2 ignored; 0 measured; 838 filtered out; finished in 0.12s

Both target tests are ignored (as expected); all sibling admin tests pass. 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.

Fixes #4083

… BUZZ_TEST_DATABASE_URL unset (block#4083)

Mirror the fix from block#4080 for api::media::tests, applying the same
`#[ignore = "requires a live Postgres: set BUZZ_TEST_DATABASE_URL"]`
attribute to the two admin report/feedback 404 tests that hit a DB
pool before asserting 404:

- `admin::tests::report_detail_rejects_unknown_report`
- `admin::tests::feedback_attachment_rejects_unknown_feedback`

Sibling 403 (admin-host gate) tests continue to pass without Postgres.
Opt back into the live-PG surface with `BUZZ_TEST_DATABASE_URL=... cargo
test -p buzz-relay -- --include-ignored`.

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant