mirror of
https://github.com/block/buzz.git
synced 2026-10-28 13:01:10 +00:00
test: bind discovery guard checks to shared snapshot constructor
Signed-off-by: cyberpunk <d6839277d8e2b34d4f50da40d4de079dc36df4c282e87147aaaa2674c070cf5a@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -718,14 +718,24 @@ fn event_write_paths_include_tenant_local_chokepoint_calls() {
|
||||
"parameterized replacements must include a tenant-local chokepoint call"
|
||||
);
|
||||
|
||||
let channel_members = include_str!("../src/store/channel_members.rs");
|
||||
let snapshot_lock = channel_members
|
||||
.split_once("pub async fn lock_member_snapshot(\n")
|
||||
.expect("channel_members must expose lock_member_snapshot")
|
||||
.1
|
||||
.split_once("/// Add a member to a channel.")
|
||||
.expect("snapshot lock path must precede member add path")
|
||||
.0;
|
||||
let snapshots = include_str!("../src/store/channel_members/snapshot.rs");
|
||||
for entry in [
|
||||
"pub async fn lock_member_snapshot(",
|
||||
"pub async fn lock_admin_snapshot(",
|
||||
] {
|
||||
let route = function_slices(snapshots)
|
||||
.into_iter()
|
||||
.find(|function| function_header(function).starts_with(entry))
|
||||
.expect("discovery entry point must exist");
|
||||
assert!(
|
||||
route.contains("lock_snapshot("),
|
||||
"{entry} must use the admitted constructor"
|
||||
);
|
||||
}
|
||||
let snapshot_lock = function_slices(snapshots)
|
||||
.into_iter()
|
||||
.find(|function| function_header(function).starts_with("async fn lock_snapshot("))
|
||||
.expect("shared snapshot constructor must exist");
|
||||
assert!(
|
||||
has_any_tenant_local_chokepoint(snapshot_lock),
|
||||
"snapshot publication locks must include a tenant-local chokepoint call"
|
||||
@@ -933,8 +943,8 @@ const GUARDED_WRITE_FUNCTION_EXCEPTIONS: [&str; 3] = [
|
||||
];
|
||||
|
||||
const GUARDED_TX_ADAPTER_METHOD_PINS: [(&str, &str); 1] = [(
|
||||
"pub async fn replace_member_event(",
|
||||
"pub async fn lock_member_snapshot(",
|
||||
"pub async fn replace_discovery_event(",
|
||||
"async fn lock_snapshot(",
|
||||
)];
|
||||
|
||||
fn production_contains_guarded_write(production_source: &str) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user