diff --git a/knot2/crates/knot-bench/src/fixtures.rs b/knot2/crates/knot-bench/src/fixtures.rs index 4bac0d944..8361b90e0 100644 --- a/knot2/crates/knot-bench/src/fixtures.rs +++ b/knot2/crates/knot-bench/src/fixtures.rs @@ -492,8 +492,9 @@ fn owner_context<'a>(owner: &'a AccountDid, repo: &'a RepoDid) -> knot_cob::Writ } fn issue_body(repo: &RepoDid, owner: &AccountDid, revision: u32) -> knot_types::RecordBody { - use knot_record::issue::{IssueProse, IssueRecord, IssueTitle}; - let prose = IssueProse::new( + use knot_record::Prose; + use knot_record::issue::{IssueRecord, IssueTitle}; + let prose = Prose::new( IssueTitle::new(format!("revision {revision}")).expect("a numbered title"), None, None, diff --git a/knot2/crates/knot-config/src/lib.rs b/knot2/crates/knot-config/src/lib.rs index 82f588c3f..47f7e7a23 100644 --- a/knot2/crates/knot-config/src/lib.rs +++ b/knot2/crates/knot-config/src/lib.rs @@ -1319,6 +1319,7 @@ mod tests { per_actor_reservations: 32, reservation_ttl_secs: 3_600, fork_max_pack_bytes: 1_073_741_824, + import_max_pack_bytes: 268_435_456, fork_fetch_timeout_ms: 600_000, trusted_proxy_header: None, trusted_proxies: Vec::new(), diff --git a/knot2/crates/knot-sim/tests/lfs_roundtrip.rs b/knot2/crates/knot-sim/tests/lfs_roundtrip.rs index dbeb72222..e04388b08 100644 --- a/knot2/crates/knot-sim/tests/lfs_roundtrip.rs +++ b/knot2/crates/knot-sim/tests/lfs_roundtrip.rs @@ -232,6 +232,7 @@ struct World { ssh_port: u16, http_base: String, router: axum::Router, + _imports_stop: tokio::sync::watch::Sender, layout: Layout, h3: Option, _certdir: Option, @@ -328,8 +329,9 @@ async fn spawn(published_line: String, with_h3: bool) -> World { http_listener.local_addr().unwrap().port() ); + let (imports, jobs) = knot_xrpc::imports::ImportQueue::channel(); let xrpc_state = Arc::new(knot_xrpc::XrpcState { - imports: knot_xrpc::imports::ImportQueue::channel().0, + imports, ci_logs: None, layout: layout.clone(), index: Arc::clone(&index), @@ -394,6 +396,13 @@ async fn spawn(published_line: String, with_h3: bool) -> World { rkeys: Default::default(), }); + let (_imports_stop, imports_halt) = tokio::sync::watch::channel(false); + tokio::spawn(knot_xrpc::imports::run( + Arc::clone(&xrpc_state), + jobs, + imports_halt, + )); + let resolver: Arc = { let index = Arc::clone(&index); Arc::new(move |target: &knot_pack::RepoTarget| match target { @@ -461,6 +470,7 @@ async fn spawn(published_line: String, with_h3: bool) -> World { ssh_port, http_base, router, + _imports_stop: _imports_stop, layout, h3, _certdir: certdir, @@ -520,7 +530,10 @@ async fn create_fork(world: &World, jti: &str) -> (http::StatusCode, serde_json: let body = serde_json::json!({ "rkey": FORK_NAME, "name": FORK_NAME, - "source": format!("{}/{OWNER_DID}/{REPO_NAME}", world.http_base), + "source": format!( + "https://{}/{OWNER_DID}/{REPO_NAME}", + world.http_base.trim_start_matches("http://") + ), }); let request = http::Request::builder() .method("POST") @@ -604,9 +617,28 @@ async fn the_lfs_round_trip_gate_holds_over_both_transports_and_the_fork() { "local fork must copy every object, got {created}" ); let fork_did = RepoDid::new(created["repoDid"].as_str().unwrap()).unwrap(); + let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(30); + let forked = loop { + if let Some(size) = world.lfs.store.probe(&fork_did, &media_oid).unwrap() { + break size; + } + assert!( + tokio::time::Instant::now() < deadline, + "the queued fork import never landed its copy of the media; sidecar: {}", + std::fs::read_to_string( + world + .layout + .repo_path(&fork_did) + .unwrap() + .join("tangled.import.json") + ) + .unwrap_or_else(|error| format!("unreadable: {error}")) + ); + tokio::time::sleep(std::time::Duration::from_millis(25)).await; + }; assert_eq!( - world.lfs.store.probe(&fork_did, &media_oid).unwrap(), - Some(LfsSize::new(media.len() as u64)), + forked, + LfsSize::new(media.len() as u64), "fork prefix must hold its own copy of the media" ); diff --git a/knot2/crates/knot-sim/tests/reproducible.rs b/knot2/crates/knot-sim/tests/reproducible.rs index 76854e36b..b875cb53d 100644 --- a/knot2/crates/knot-sim/tests/reproducible.rs +++ b/knot2/crates/knot-sim/tests/reproducible.rs @@ -283,11 +283,11 @@ async fn roster_read_and_roster_write_land_in_separate_rounds() { }); [OFFERS.as_slice(), ROSTER_READS.as_slice()] - .into_iter() - .for_each(|names| { - assert!( - rounds.values().any(|ops| holds(ops, names)), - "the rule is vacuous unless {names:?} run in some round" - ); - }); + .into_iter() + .for_each(|names| { + assert!( + rounds.values().any(|ops| holds(ops, names)), + "the rule is vacuous unless {names:?} run in some round" + ); + }); } diff --git a/knot2/example.toml b/knot2/example.toml index 1d09e6d42..97238b9da 100644 --- a/knot2/example.toml +++ b/knot2/example.toml @@ -269,6 +269,9 @@ # Can also be specified via environment variable `KNOT_XRPC_FORK_MAX_PACK_BYTES`. # Default value: 1073741824 #fork_max_pack_bytes = 1073741824 + +# Can also be specified via environment variable `KNOT_XRPC_IMPORT_MAX_PACK_BYTES`. +# Default value: 268435456 #import_max_pack_bytes = 268435456 # Can also be specified via environment variable `KNOT_XRPC_FORK_FETCH_TIMEOUT_MS`.