From 9198640bd9e4aefffdff2ef86959f61f63cb2589 Mon Sep 17 00:00:00 2001 From: Bendik Lynghaug Date: Sun, 16 Aug 2026 15:28:22 +0200 Subject: [PATCH] Serialize the mdns tests and relax push-test deadlines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit push_hands_content_to_trusted_peer failed on CI: the test harness runs lan_trust tests in parallel, so the three mdns-dependent tests spawn six daemons at once — multicast timing and two runner cores don't survive that. A process-wide mutex runs them one at a time, and the push deadlines now match the 60s convention of the other transfer tests. Co-Authored-By: Claude Fable 5 --- varde-daemon/tests/lan_trust.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/varde-daemon/tests/lan_trust.rs b/varde-daemon/tests/lan_trust.rs index 51eff2e..21e092e 100644 --- a/varde-daemon/tests/lan_trust.rs +++ b/varde-daemon/tests/lan_trust.rs @@ -78,6 +78,11 @@ fn wait_complete(socket: &Path, hash: &str, timeout: Duration) -> bool { false } +/// mdns tests spawn two daemons each and depend on multicast timing; +/// run them one at a time so they don't starve each other on small CI +/// runners. +static MDNS_SERIAL: std::sync::Mutex<()> = std::sync::Mutex::new(()); + /// Re-target a ticket at another hash on the same provider: what an /// attacker who learned a hash out of band would hand to their daemon. fn forge_ticket(real_ticket: &str, target_hash: &str) -> String { @@ -225,6 +230,7 @@ fn subscribe_streams_progress_and_completion() { /// sibling process. #[test] fn overlapping_pins_auto_sync_via_lan_discovery() { + let _serial = MDNS_SERIAL.lock().unwrap_or_else(|e| e.into_inner()); let dir_a = tempfile::tempdir().unwrap(); let dir_b = tempfile::tempdir().unwrap(); let a = support::spawn_daemon_with_env(dir_a.path(), &[("VARDE_DISCOVERY", "true")]); @@ -302,6 +308,7 @@ fn wait_peer_connected(client: &mut support::Client, timeout: Duration) -> bool /// accepted, so the content survives gc and lists as a pin. #[test] fn push_hands_content_to_trusted_peer() { + let _serial = MDNS_SERIAL.lock().unwrap_or_else(|e| e.into_inner()); let dir_a = tempfile::tempdir().unwrap(); let dir_b = tempfile::tempdir().unwrap(); let a = support::spawn_daemon_with_env(dir_a.path(), &[("VARDE_DISCOVERY", "true")]); @@ -349,13 +356,13 @@ fn push_hands_content_to_trusted_peer() { } // The receiver has the bytes, and pinned them. - if !wait_complete(&b.socket, &hash, Duration::from_secs(30)) { + if !wait_complete(&b.socket, &hash, Duration::from_secs(60)) { let reply = client_b.request(&Request::Status { hash: Some(hash.clone()), }); panic!("pushed content not complete on receiver; status: {reply:?}"); } - let deadline = Instant::now() + Duration::from_secs(10); + let deadline = Instant::now() + Duration::from_secs(30); loop { let reply = client_b.request(&Request::List {}); if let Some(ResponseData::Pins { pins }) = &reply.data { @@ -383,6 +390,7 @@ fn push_hands_content_to_trusted_peer() { /// the push, even though the sender trusts the receiver. #[test] fn push_rejected_without_receiver_trust() { + let _serial = MDNS_SERIAL.lock().unwrap_or_else(|e| e.into_inner()); let dir_a = tempfile::tempdir().unwrap(); let dir_b = tempfile::tempdir().unwrap(); let a = support::spawn_daemon_with_env(dir_a.path(), &[("VARDE_DISCOVERY", "true")]);