test(hbbs): assert which punch-request records survive eviction

The length check alone passed if the newest record were evicted or new
records were dropped once full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
This commit is contained in:
rustdesk
2026-10-10 16:34:53 +08:00
co-authored by Claude Opus 5.5
parent b0a07de9be
commit d75a9aad92
+4
View File
@@ -1442,5 +1442,9 @@ mod tests {
.await; .await;
} }
assert_eq!(PUNCH_REQS.lock().await.len(), *PUNCH_REQ_MAX); assert_eq!(PUNCH_REQS.lock().await.len(), *PUNCH_REQ_MAX);
// the oldest half is evicted and the newest kept
let lock = PUNCH_REQS.lock().await;
assert_eq!(lock.front().unwrap().to_id, format!("peer{}", *PUNCH_REQ_MAX % 31));
assert_eq!(lock.back().unwrap().to_id, format!("peer{}", (*PUNCH_REQ_MAX * 2 - 1) % 31));
} }
} }