test: protect durable behavior identified in review

This commit is contained in:
Nils Andreas Svee committed 2026-10-02 16:12:52 +07:00
1 parent e115b96f21
commit 83b3607228
7 files changed
+528 -6

No files matched your search

@@ -1,6 +1,6 @@
//! Independent count and time windows must match a filtered replay through
//! StatsCollector, while cumulative accounting retains the complete history.
//! Generated events use non-decreasing timestamps, as required by the collector.
//! Generated events have non-decreasing normalized window timestamps.
use std::time::{Duration, Instant, UNIX_EPOCH};
@@ -170,7 +170,7 @@ fn build_event(op: &Op, seq: u32, clock_ms: u64, base: Instant) -> ClientEvent {
Op::Loss => ClientEvent::EchoLoss {
seq,
sent_at: ts_at(base, clock_ms),
timeout_at: ts_at(base, clock_ms).mono,
timeout_at: ts_at(base, clock_ms).mono - Duration::from_millis(10),
},
Op::Warning => ClientEvent::Warning {
kind: irtt_client::WarningKind::UntrackedReply,
@@ -233,6 +233,11 @@ proptest! {
// scratch after every step.
let mut history: Vec<(ClientEvent, u64)> = Vec::new();
// Force a loss whose clamped time evicts the initial send, while its
// raw pre-send deadline would retain it. Every generated case must
// therefore distinguish the two normalization choices.
let ops = [Op::Send, Op::Advance(u16::try_from(time_limit_ms + 5).unwrap()), Op::Loss, Op::Advance(10), Op::Warning]
.into_iter().chain(ops).collect::<Vec<_>>();
for (idx, op) in ops.iter().enumerate() {
if let Op::Advance(delta) = op {
clock_ms += u64::from(*delta);