Skip to content

Commit 5c718f2

Browse files
TheSentinel454Elrondclaude
committed
test(relay): cover shared connections in the fan-out equivalence test
Draw subscriptions from a small pool of connections so the randomized test also covers several matching subscriptions on one connection, and narrow its doc comment to what it proves: delivery equivalence with a full filter scan, once per subscription. Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Luke Tornquist <[email protected]>
1 parent ba317a5 commit 5c718f2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎crates/buzz-relay/src/subscription.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,8 +2056,8 @@ mod tests {
20562056
}
20572057

20582058
/// Indexed global fan-out delivers to exactly the subscriptions a full
2059-
/// `filters_match` scan selects, across random filter sets and `p`-tag
2060-
/// shapes, so the index's tag reading can't drift from the matcher's.
2059+
/// `filters_match` scan selects, once each, across random filter sets,
2060+
/// `p`-tag shapes and connections holding several subscriptions.
20612061
#[test]
20622062
fn global_fan_out_matches_a_full_filter_scan() {
20632063
// xorshift64*, seeded, so a failing case reproduces.
@@ -2076,6 +2076,7 @@ mod tests {
20762076
let authors: Vec<Keys> = (0..3).map(|_| Keys::generate()).collect();
20772077
let author_keys: Vec<PublicKey> = authors.iter().map(Keys::public_key).collect();
20782078
let p_values = ["a".repeat(64), "b".repeat(64), "not-hex".to_string()];
2079+
let conn_ids: Vec<ConnId> = (0..8).map(|_| Uuid::new_v4()).collect();
20792080

20802081
let registry = SubscriptionRegistry::new();
20812082
let mut subscriptions = Vec::new();
@@ -2095,7 +2096,7 @@ mod tests {
20952096
filter
20962097
})
20972098
.collect();
2098-
let (conn_id, sub_id) = (Uuid::new_v4(), format!("sub-{i}"));
2099+
let (conn_id, sub_id) = (conn_ids[next(conn_ids.len())], format!("sub-{i}"));
20992100
registry.register(conn_id, sub_id.clone(), filters.clone(), None);
21002101
subscriptions.push((conn_id, sub_id, filters));
21012102
}

0 commit comments

Comments
 (0)