Skip to content

test(relay): skip 7 PG-dependent media tests when BUZZ_TEST_DATABASE_URL unset (#4080) - #4081

Open
iroiro147 wants to merge 2 commits into
block:mainfrom
iroiro147:claude/issue4080-20260801
Open

test(relay): skip 7 PG-dependent media tests when BUZZ_TEST_DATABASE_URL unset (#4080)#4081
iroiro147 wants to merge 2 commits into
block:mainfrom
iroiro147:claude/issue4080-20260801

Conversation

@iroiro147

Copy link
Copy Markdown

Summary

Fixes #4080.

cargo test -p buzz-relay on a contributor machine without a local Postgres previously reported 9 failures: 7 spurious Sqlx(PoolTimedOut) errors in api::media::tests plus 2 pre-existing admin-test fails. The 7 media fails are environmental — the tests need Postgres but are plain #[tokio::test] so they run unconditionally.

This PR marks them with the same #[ignore = "requires a live Postgres: set BUZZ_TEST_DATABASE_URL"] pattern already established in crates/buzz-search/tests/fts_integration.rs. They remain runnable via:

cargo test -p buzz-relay -- --include-ignored   # with BUZZ_TEST_DATABASE_URL set

Tests changed

All inside crates/buzz-relay/src/api/media.rs::tests:

  • media_get_auth_flag_off_allows_unauthenticated_read_until_sidecar_gate
  • media_get_auth_flag_on_rejects_unauthenticated_get_and_head_before_sidecar_gate
  • media_get_auth_flag_on_valid_server_scoped_token_reaches_sidecar_gate
  • media_get_auth_flag_on_rejects_upload_verb_wrong_server_and_wrong_x
  • media_get_auth_flag_on_accepts_range_header_only_after_auth
  • upload_rate_limiter_is_scoped_by_community
  • upload_concurrency_limit_is_scoped_by_community

Verification

Local macOS, no dev Postgres running:

cargo check -p buzz-relay                # clean
cargo test -p buzz-relay --lib --no-fail-fast
# Before: 824 passed; 9 failed; 0 ignored
# After : 826 passed; 2 failed; 42 ignored
#         (the 2 remaining fails are pre-existing admin-test drift — out of scope)
cargo test -p buzz-relay api::media -- --include-ignored
# → 7 media tests run and fail with PoolTimedOut, confirming they're correctly gated

CI behavior is expected to be unchanged, since CI sets BUZZ_TEST_DATABASE_URL and runs with --include-ignored (or never relied on these tests being default-on in the first place).

Out of scope

  • The 2 pre-existing admin-test fails (feedback_attachment_rejects_unknown_feedback, report_detail_rejects_unknown_report) — separate semantic-drift investigation.
  • Refactoring test_state() so upload_*_scoped_by_community tests don't need PG at all (they test an in-memory rate limiter and only hit PG via ensure_configured_community seeding). Tracked in test(relay): skip 7 PG-dependent media tests when BUZZ_TEST_DATABASE_URL unset #4080 as a follow-up.

…URL unset (block#4080)

Default `cargo test -p buzz-relay` on a contributor machine without a
local Postgres previously reported 7 spurious PoolTimedOut failures
inside api::media::tests. Mark them #[ignore] per the existing
fts_integration.rs pattern; they remain runnable via
`cargo test -p buzz-relay -- --include-ignored` with
BUZZ_TEST_DATABASE_URL set.

Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
… BUZZ_TEST_DATABASE_URL unset (block#4083)

Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
@iroiro147

Copy link
Copy Markdown
Author

Follow-up: the 2 pre-existing admin-test fails called out above are now fixed in this branch (commit 31869fc7). Same #[ignore = "requires a live Postgres: set BUZZ_TEST_DATABASE_URL"] pattern, applied to report_detail_rejects_unknown_report and feedback_attachment_rejects_unknown_feedback in crates/buzz-relay/src/api/admin/mod.rs. Filed upstream as #4083 for traceability; the fix is included here.

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 7 PG-dependent media tests when BUZZ_TEST_DATABASE_URL unset

1 participant