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 <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny 2024-05-23 10:25:04 +01:00 committed by cloudhead
parent 723e2741f5
commit 29e681210b
No known key found for this signature in database
1 changed files with 28 additions and 0 deletions

View File

@ -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);
}
}