From 7469406a45ab625d9ba6ad430f01573c16f8f4de Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 23:00:34 +0000 Subject: simtest: a swarm holding a store, its members and a node its party doesn't list tv lists a and b, which start from the store's root; lass lists c, which joins by the store's ID; d is of lass too, which doesn't list it. Events put on a and on c reach a, b and c, which read them; d, which no member syncs with, gets nothing. A simulated node started on a document expects its swarm, as `run` has it do. --- src/simtest/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/simtest/mod.rs') diff --git a/src/simtest/mod.rs b/src/simtest/mod.rs index 4da8821..b886721 100644 --- a/src/simtest/mod.rs +++ b/src/simtest/mod.rs @@ -11,6 +11,8 @@ mod bench; mod deltas; +#[cfg(feature = "federation")] +mod holding; mod hyparview; mod identity; mod policy; @@ -248,6 +250,19 @@ impl Sim { let bootstrapping = state.clone(); let id = id.to_owned(); tokio::spawn(async move { + // As `run` does: a document to start on names its swarm, the one it joins. + if let Start::FromDocument(_) = start { + let swarm = store::read_path( + &bootstrapping.doc.read().await.doc, + &crate::document::meta::path(&[crate::document::meta::SWARM]), + ); + if let Ok(Some(JsonValue::String(swarm_id))) = swarm { + bootstrapping + .set_expected_swarm_id(swarm_id) + .await + .expect("the swarm of the document to start on"); + } + } if let Err(error) = bootstrap::bootstrap(&bootstrapping, &seeds, start).await { panic!("bootstrapping {id} failed: {error:#}"); } -- cgit v1.3.1