aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest/holding.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/simtest/holding.rs')
-rw-r--r--src/simtest/holding.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/simtest/holding.rs b/src/simtest/holding.rs
index 66d5d15..4b3277a 100644
--- a/src/simtest/holding.rs
+++ b/src/simtest/holding.rs
@@ -1983,3 +1983,52 @@ async fn a_node_of_a_set_joins_with_nothing_but_the_stores_id() {
})
.await;
}
+
+/// d is of lass, which doesn't list it: given the store's ID, it reaches a, which takes
+/// none of its handshakes and gives it nothing, neither the root nor an event. It never
+/// holds the store.
+#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
+async fn a_node_no_party_lists_gets_nothing_of_a_set() {
+ use crate::federation::store::passing;
+
+ let sim = Sim::with_identity(95);
+ let (tv, lass, _) = three();
+ let (_, root, id) = federation(&[(&tv, &["a", "b"]), (&lass, &["c"])]);
+ let a = start_on_a_set(&sim, "a", "tv", id, a_set(&root), None, false);
+ let b = start_on_a_set(&sim, "b", "tv", id, a_set(&root), None, false);
+ sim.wait_ready(&[&a, &b], SOON).await;
+ let write = tv.write(&[id], "home/tv/x", s("1"));
+ put(&a, &[&write]).await;
+ let pair = &[&a, &b];
+ sim.wait_until(
+ "a and b hold each other's entries",
+ SOON,
+ move || async move { pair.iter().all(|node| entries(node) == 2) },
+ )
+ .await;
+
+ let d = sim.start_with(
+ "d",
+ &["a"],
+ Start::FromDocument(Origin::Root),
+ move |config| {
+ config.store = Some(id);
+ config.holding = holding("lass").carrying_if(
+ Some(held::Begun::Start(passing::Start::new(
+ id,
+ id,
+ Duration::from_secs(600),
+ ))),
+ None,
+ Arc::new(Files::default()),
+ );
+ },
+ );
+ // Long enough for it to have joined, were it let in.
+ tokio::time::sleep(Duration::from_secs(4)).await;
+ assert!(!d.is_ready().await);
+ assert!(read(&d, |_| ()).is_none());
+ assert!(!d.holding.start_wants().is_empty());
+ // And a holds no entry of it.
+ assert_eq!(entries(&a), 2);
+}