From 29e681210b1e568770ed6fc4d5ee11e7d346b5c4 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Thu, 23 May 2024 10:25:04 +0100 Subject: [PATCH] node: test multiple offline inits Ensure that when a node initialises multiple repositories, those repositories can successfully be fetched by another peer once they connect. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/tests/e2e.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/radicle-node/src/tests/e2e.rs b/radicle-node/src/tests/e2e.rs index af77677b..33d4afd1 100644 --- a/radicle-node/src/tests/e2e.rs +++ b/radicle-node/src/tests/e2e.rs @@ -1335,3 +1335,31 @@ fn test_catchup_on_refs_announcements() { alice.connect(&seed); alice.has_remote_of(&acme, &bob_id); } + +#[test] +fn test_multiple_offline_inits() { + logger::init(log::Level::Debug); + + let tmp = tempfile::tempdir().unwrap(); + + let mut alice = Node::init(tmp.path(), config::relay("alice")); + let bob = Node::init(tmp.path(), config::relay("bob")); + + let acme = alice.project("acme", ""); + let radcliffe = alice.project("radcliffe", ""); + let cobs = alice.project("cobs", ""); + let projects = [acme, radcliffe, cobs]; + + let mut alice = alice.spawn(); + let mut bob = bob.spawn(); + + for rid in &projects { + bob.handle.seed(*rid, Scope::All).unwrap(); + } + + alice.connect(&bob).converge([&bob]); + + for repo in bob.storage.repositories().unwrap() { + assert!(projects.contains(&repo.rid), "Bob is missing {}", repo.rid); + } +}