From 865b150371d4e15562d63f0e9837bca0c32540d7 Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Tue, 3 Nov 2026 19:30:32 -0500 Subject: [PATCH] fix(db): use ScratchDb in the storage usage delivery test (#9032) --- crates/buzz-db/src/store/storage_accounting.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/crates/buzz-db/src/store/storage_accounting.rs b/crates/buzz-db/src/store/storage_accounting.rs index 12f88bba04..b34e83921c 100644 --- a/crates/buzz-db/src/store/storage_accounting.rs +++ b/crates/buzz-db/src/store/storage_accounting.rs @@ -261,12 +261,8 @@ mod postgres_tests { #[tokio::test] #[ignore = "requires Postgres"] async fn usage_delivery_reads_snapshot_time_and_community_states() { - let admin = PgPoolOptions::new() - .max_connections(1) - .connect(&crate::test_support::database_url()) - .await - .expect("connect admin"); - let (pool, name) = create_scratch_db(&admin).await; + let (pool, _scratch) = + ScratchDb::migrated(&crate::test_support::database_url(), "storage_accounting").await; let db = Db::from_pool(pool.clone()); assert_eq!( @@ -327,14 +323,5 @@ mod postgres_tests { communities.sort_by(|a, b| a.host.cmp(&b.host)); expected.sort_by(|a, b| a.host.cmp(&b.host)); assert_eq!(communities, expected); - - drop(leader); - drop(db); - pool.close().await; - let _ = sqlx::query(sqlx::AssertSqlSafe(format!( - "DROP DATABASE IF EXISTS {name} WITH (FORCE)" - ))) - .execute(&admin) - .await; } }