test(managed): cover group late replies during final drain

Exercise a real one-target ManagedClientGroup through timeout, Draining, a gated retained reply, LateReply classification, local close, and authoritative TargetFinished publication. Synchronize release after EchoLoss and a scheduler-handled no-op update so the ordering is deterministic rather than delay-dependent.

Add a silent-server control that verifies completion only after the final-drain deadline, and assert bounded join, queued-event draining through disconnection, target counters, terminal outcome equality, and group aggregates in both cases.

Harden the analogous single-client late-drain test with a viable one-probe run window and packet-shape checks. No production final-drain behavior change was required.
This commit is contained in:
Nils Andreas Svee committed 2026-07-28 15:55:18 +07:00
1 parent 7cc55bd619
commit dfe0534905
2 files changed
+293 -2

No files matched your search

+10 -2
View File
@@ -465,6 +465,12 @@ mod tests {
let Some((packet, peer)) = recv_request_timeout(&socket) else {
return;
};
assert_eq!(packet[3] & flags::FLAG_CLOSE, 0);
assert!(
packet.len() >= 16,
"echo request too short: {}",
packet.len()
);
let seq = u32::from_le_bytes(packet[12..16].try_into().unwrap());
thread::sleep(delay);
let ts = TimestampFields {
@@ -725,10 +731,12 @@ mod tests {
#[test]
fn finite_managed_run_drains_late_reply_after_timeout_before_close() {
let duration = Duration::from_millis(1);
let params = test_params(Some(duration), Duration::from_millis(10));
let interval = Duration::from_millis(100);
let duration = interval;
let params = test_params(Some(duration), interval);
let server = start_delayed_reply_server(params, Duration::from_millis(60));
let mut cfg = config(server.addr, Some(duration));
cfg.interval = interval;
cfg.probe_timeout = Duration::from_millis(20);
let (session, sub) = ManagedClient::start_with_subscription(