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
Open
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rshas two PG-dependent integration tests that fail hard without a live Postgres, mirroring the exact problem tracked in #4080 forapi::media::tests:admin::tests::report_detail_rejects_unknown_reportadmin::tests::feedback_attachment_rejects_unknown_feedbackBoth call
test_state()which eagerly seeds a community viaensure_configured_community— panicking whenBUZZ_DATABASE_URLis unset (and hittingPoolTimedOut/ 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-
authorizeDB call.Fix
Apply the same
#[ignore = "requires a live Postgres: set BUZZ_TEST_DATABASE_URL"]attribute pattern used in:crates/buzz-search/tests/fts_integration.rscrates/buzz-relay/src/api/media.rs(landed for test(relay): skip 7 PG-dependent media tests when BUZZ_TEST_DATABASE_URL unset #4080)Testing
In a PG-less environment with
BUZZ_TEST_DATABASE_URL/BUZZ_DATABASE_URLunset: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-ignoredFollow-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