cultmesh-rs tests: an unsubscribed id is neither resent nor unsubscribed again

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 05:14:57 +01:00
commit c7aedf5494

View file

@ -416,11 +416,15 @@ fn dropping_the_client_unsubscribes_each_live_id_and_stops_its_thread() {
peer.subscribe_id();
peer.subscribe_id();
assert!(matches!(peer.next(), CultNetMessage::DatabaseUnsubscribe { subscription_id, .. } if subscription_id == "two"));
// An unsubscribed id is forgotten: not resent, not unsubscribed again.
client.resubscribe_all().unwrap();
assert_eq!(peer.subscribe_id().1, "one");
let before = thread_count();
let started = Instant::now();
drop(client);
assert!(started.elapsed() < Duration::from_secs(2), "drop joins promptly");
assert!(matches!(peer.next(), CultNetMessage::DatabaseUnsubscribe { subscription_id, .. } if subscription_id == "one"));
assert!(peer.received.recv_timeout(Duration::from_millis(300)).is_err(), "nothing else is sent");
if cfg!(target_os = "linux") {
assert!(thread_count() < before, "the pump thread is gone with its handle");
}