test(managed): verify timeout budget fairness

This commit is contained in:
Nils Andreas Svee committed 2026-08-10 01:18:38 +07:00
1 parent a67331a297
commit 4632e310d7
5 files changed
+457 -4

No files matched your search

+33 -1
View File
@@ -16,7 +16,10 @@ use irtt_proto::{
use tokio::runtime::{Builder, Runtime};
use super::*;
use crate::{socket_options::tokio_socket_traffic_class, Client, RunMode, SocketConfig};
use crate::{
probe::PendingProbe, socket_options::tokio_socket_traffic_class, Client, ClientTimestamp,
RunMode, SocketConfig,
};
const TOKEN: u64 = 0x1234_5678_90ab_cdef;
@@ -708,6 +711,35 @@ fn probe_false_readiness_resamples_all_timestamps() {
assert_eq!(server.finish().len(), 2);
}
#[test]
fn public_timeout_polling_remains_exhaustive() {
let server = start_open_server(None, 0);
runtime().block_on(async {
let mut client = opened_client(server.addr, 0).await;
let now = Instant::now();
for seq in 0..3 {
client.replace_pending_for_test(PendingProbe {
wire_seq: seq,
sent_at: ClientTimestamp {
mono: now - Duration::from_secs(2),
wall: SystemTime::UNIX_EPOCH,
},
timeout_at: now - Duration::from_secs(1),
});
}
assert!(matches!(
client.poll_timeouts_at(now).unwrap().as_slice(),
[
ClientEvent::EchoLoss { seq: 0, .. },
ClientEvent::EchoLoss { seq: 1, .. },
ClientEvent::EchoLoss { seq: 2, .. },
]
));
});
assert_eq!(server.finish().len(), 1);
}
#[test]
fn successful_short_probe_commits_before_length_error() {
let server = start_open_server(None, 0);