diff options
| author | tv <tv@krebsco.de> | 2026-11-16 23:00:34 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 00:09:49 +0100 |
| commit | 7469406a45ab625d9ba6ad430f01573c16f8f4de (patch) | |
| tree | 222d51fc94faedd0761439b6eee0e6c360b13593 /src/simtest/mod.rs | |
| parent | ce8ccdc68f5b0cc52b380177665ee07505c5bfb5 (diff) | |
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.
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:#}"); } |
