node: Test fetch with large repository

This is for stress-testing the replication.
This commit is contained in:
Alexis Sellier 2023-04-13 15:28:27 +02:00
parent ac3a03fea6
commit a05de1fbf3
No known key found for this signature in database
1 changed files with 35 additions and 0 deletions

View File

@ -459,6 +459,41 @@ fn test_fetch_up_to_date() {
assert_eq!(result.success(), Some(vec![]));
}
#[test]
fn test_large_fetch() {
logger::init(log::Level::Debug);
let env = Environment::new();
let scale = env.scale();
let mut alice = Node::init(&env.tmp());
let bob = Node::init(&env.tmp());
let tmp = tempfile::tempdir().unwrap();
let (repo, _) = fixtures::repository(tmp.path());
fixtures::populate(&repo, scale.max(3));
let rid = alice.project_from("acme", "", &repo);
let mut alice = alice.spawn(service::Config::default());
let mut bob = bob.spawn(service::Config::default());
let bob_events = bob.handle.events();
bob.handle.track_repo(rid, Scope::All).unwrap();
alice.connect(&bob);
bob_events
.wait(
|e| matches!(e, service::Event::RefsFetched { updated, .. } if !updated.is_empty()),
time::Duration::from_secs(9 * scale as u64),
)
.unwrap();
let (_, doc) = bob.storage.repository(rid).unwrap().identity_doc().unwrap();
let proj = doc.verified().unwrap().project().unwrap();
assert_eq!(proj.name(), "acme");
}
#[test]
fn test_concurrent_fetches() {
logger::init(log::Level::Debug);