diff --git a/knot2/crates/knot-xrpc/tests/ref_records.rs b/knot2/crates/knot-xrpc/tests/ref_records.rs index 13b3ed5a8..c2cc7f512 100644 --- a/knot2/crates/knot-xrpc/tests/ref_records.rs +++ b/knot2/crates/knot-xrpc/tests/ref_records.rs @@ -47,7 +47,7 @@ fn record_of<'r>(items: &'r [Value], rkey: &str) -> &'r Value { .unwrap_or_else(|| panic!("no record for rkey {rkey} in {items:?}")) } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] struct OpProbe { action: String, path: String, @@ -258,13 +258,22 @@ async fn a_mirror_sized_first_push_chunks_at_two_hundred_ops() { assert!( payload.ops.iter().all(|op| { op.action == "create" - && op + && (op .path .starts_with(&format!("{COLLECTION}/refs~2fheads~2f")) + || op.path == "org.tangled.git.refs/self") }), - "every op names a head ref record" + "every op names a head ref record or the summary seeded at birth: {:?}", + payload.ops ); - creates += payload.ops.len(); + creates += payload + .ops + .iter() + .filter(|op| { + op.path + .starts_with(&format!("{COLLECTION}/refs~2fheads~2f")) + }) + .count(); *seq }) .collect::>(); @@ -275,7 +284,7 @@ async fn a_mirror_sized_first_push_chunks_at_two_hundred_ops() { ); } -#[tokio::test] +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn the_boot_pass_catches_up_a_ref_that_moved_without_a_record() { let world = World::new(); let (did, _bare, work) = empty_repo(&world, "coral"); @@ -293,8 +302,10 @@ async fn the_boot_pass_catches_up_a_ref_that_moved_without_a_record() { new: main, }) .unwrap(); - - knot_xrpc::materialize::enable_surfaces(&world.state); + let state = std::sync::Arc::clone(&world.state); + tokio::task::spawn_blocking(move || knot_xrpc::materialize::enable_surfaces(&state)) + .await + .unwrap(); let items = records(&world, &did).await; assert_eq!(items.len(), 2, "the boot pass materialized the drift"); @@ -317,7 +328,10 @@ async fn the_boot_pass_catches_up_a_ref_that_moved_without_a_record() { let settled = chain::tip(&world.layout.open(&did).unwrap()) .unwrap() .unwrap(); - knot_xrpc::materialize::enable_surfaces(&world.state); + let state = std::sync::Arc::clone(&world.state); + tokio::task::spawn_blocking(move || knot_xrpc::materialize::enable_surfaces(&state)) + .await + .unwrap(); assert_eq!( chain::tip(&world.layout.open(&did).unwrap()) .unwrap()