diff options
Diffstat (limited to 'src/simtest/mod.rs')
| -rw-r--r-- | src/simtest/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
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:#}"); } |
