From 9485cdfd62cdc1268ebb7112216cd4263f6aa129 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 28 Sep 2026 22:24:21 +0000 Subject: [PATCH] test: abort quota fixture through store contract Signed-off-by: Codex Co-authored-by: Codex (cherry picked from commit 546b68640aacc87a80807fdc85c43f6a42299820) Signed-off-by: Codex --- crates/buzz-db/src/store/community.rs | 31 +++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/crates/buzz-db/src/store/community.rs b/crates/buzz-db/src/store/community.rs index 8acd359dad..c8a3755b48 100644 --- a/crates/buzz-db/src/store/community.rs +++ b/crates/buzz-db/src/store/community.rs @@ -1140,7 +1140,7 @@ mod postgres_tests { let CreateCommunityWithOwnerResult::Created(created) = created else { panic!("expected created community") }; - let request_id = Uuid::new_v4(); + let mut request_id = Uuid::new_v4(); sqlx::query( "INSERT INTO community_deletion_requests \ (id, community_id, community_host, requested_by, request_origin, owner_pubkey, \ @@ -1169,9 +1169,12 @@ mod postgres_tests { "membership and request deduplicate" ); - sqlx::query("UPDATE community_deletion_requests SET stage = 'aborted' WHERE id = $1") - .bind(request_id) - .execute(&db.pool) + db.deletion_store() + .abort( + request_id, + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "quota reservation test abort", + ) .await .expect("abort quota fixture"); let aborted = db @@ -1183,11 +1186,21 @@ mod postgres_tests { aborted.quota_used, 1, "abort must fall back to the preserved membership" ); - sqlx::query("UPDATE community_deletion_requests SET stage = 'submitted' WHERE id = $1") - .bind(request_id) - .execute(&db.pool) - .await - .expect("restore pending quota fixture"); + request_id = Uuid::new_v4(); + sqlx::query( + "INSERT INTO community_deletion_requests \ + (id, community_id, community_host, requested_by, request_origin, owner_pubkey, \ + mediating_operator_pubkey, acknowledgement_version) \ + VALUES ($1, $2, $3, $4, 'owner', $4, $5, 1)", + ) + .bind(request_id) + .bind(created.id.as_uuid()) + .bind(&host) + .bind(&owner) + .bind("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .execute(&db.pool) + .await + .expect("insert replacement pending quota fixture"); sqlx::query("DELETE FROM relay_members WHERE community_id = $1") .bind(created.id.as_uuid())