mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-24 10:27:00 -06:00
test(collab-net): exercise NetLink host in large welcome regression test
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user