From 6369b6b7a5fa2c073e23cc67328bb48e8a7a92bd Mon Sep 17 00:00:00 2001 From: Kushagra Kumar Date: Tue, 20 Oct 2026 01:43:50 +0530 Subject: [PATCH] test(collab-net): exercise NetLink host in large welcome regression test --- crates/collab-net/src/loopback_tests.rs | 30 ------------------------- crates/collab-net/src/session_tests.rs | 16 +++++++++++++ 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/crates/collab-net/src/loopback_tests.rs b/crates/collab-net/src/loopback_tests.rs index b59f767c..eebda6de 100644 --- a/crates/collab-net/src/loopback_tests.rs +++ b/crates/collab-net/src/loopback_tests.rs @@ -708,33 +708,3 @@ fn oversized_server_message_reports_accurate_diagnostic() { assert!(!welcomed(&gp.events)); host.stop(); } - -#[test] -#[ignore = "allocates a document larger than 64 MiB: cargo test -p figcraft-collab-net -- --ignored"] -fn welcome_larger_than_64_mib_is_delivered() { - let mut doc = Document::new("A".repeat((64 << 20) + 4096)); - doc.repair(); - let probe = Probe::new(); - let limits = NetLimits { max_client_message: 1024, max_server_message: 128 << 20, ..fast_limits() }; - let cfg = HostConfig { - addr: SocketAddr::from(([127, 0, 0, 1], 0)), - any_port_if_taken: false, - file: FILE.into(), - token: TOKEN.into(), - doc, - name: "Hana".into(), - limits, - core: Limits { max_message_bytes: 128 << 20, ..Limits::default() }, - }; - let mut host = Host::start(cfg, probe.inbox.clone()).unwrap(); - let invite = Invite::new(host.addr().to_string(), FILE, TOKEN); - - let guest_probe = Probe::new(); - let mut guest_cfg = quick(GuestConfig::new(invite, "Ada".into())); - guest_cfg.limits = limits; - let _g = Guest::start(guest_cfg, guest_probe.inbox.clone()).unwrap(); - let mut gp = guest_probe; - gp.wait("welcome", welcomed); - assert!(welcomed(&gp.events)); - host.stop(); -} diff --git a/crates/collab-net/src/session_tests.rs b/crates/collab-net/src/session_tests.rs index 32920123..de60b211 100644 --- a/crates/collab-net/src/session_tests.rs +++ b/crates/collab-net/src/session_tests.rs @@ -249,3 +249,19 @@ fn cursor_chat_and_spotlight_between_apps() { pump(&mut host, &mut guest, "the spotlight ending", |_, g| g.live().spotlight.is_none()); pump(&mut host, &mut late, "the spotlight ending for the late joiner", |_, l| l.live().spotlight.is_none() && l.live().follow.is_none()); } + +#[test] +#[ignore = "allocates a document larger than 64 MiB: cargo test -p figcraft-collab-net -- --ignored"] +fn welcome_larger_than_64_mib_is_delivered() { + let mut host = session("Hana"); + let mut guest = session("Ada"); + host.doc_mut().unwrap().name = "A".repeat((64 << 20) + 4096); + let r = host.execute("collab.host", &json!({"port": 0})).unwrap(); + assert_eq!(r["status"], "live"); + let link = r["link"].as_str().unwrap().to_string(); + let r = guest.execute("collab.join", &json!({"link": link})).unwrap(); + assert_eq!(r["status"], "connecting"); + pump(&mut host, &mut guest, "the large welcome", |h, g| g.live().status == Status::Live && h.live().peers.len() == 1); + assert_eq!(guest.doc().unwrap().name.len(), (64 << 20) + 4096); + host.execute("collab.stop", &json!({})).unwrap(); +}