mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
test(relay): give group-state Postgres tests a normal acquire timeout
group_state_postgres_tests::state() built its pool through test_state_with_database_url, whose 100 ms acquire timeout exists so closed-port tests fail fast. Against the real test database a first connect on a busy CI runner can exceed that, and the tests fail with PoolTimedOut while creating their community. Build the pool with sqlx's default timeout and hand it to test_state_with_database_pool. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
@@ -12,8 +12,14 @@ use crate::handlers::ingest::{ingest_event, HttpAuthMethod, IngestAuth};
|
||||
use crate::state::AppState;
|
||||
use buzz_auth::Scope;
|
||||
|
||||
/// Test state on the shared test database. The pool keeps sqlx's default
|
||||
/// acquire timeout: `test_state_with_database_url` waits only 100 ms so
|
||||
/// closed-port tests fail fast, and a first connect to a busy CI database can
|
||||
/// take longer than that (`PoolTimedOut`).
|
||||
pub(crate) async fn state() -> Arc<AppState> {
|
||||
crate::state::tests::test_state_with_database_url(&crate::test_support::database_url()).await
|
||||
let pool =
|
||||
sqlx::PgPool::connect_lazy(&crate::test_support::database_url()).expect("lazy pg pool");
|
||||
crate::state::tests::test_state_with_database_pool(pool).await
|
||||
}
|
||||
|
||||
pub(crate) async fn community(state: &AppState, label: &str) -> TenantContext {
|
||||
|
||||
Reference in New Issue
Block a user