This commit is contained in:
Mateusz Gruszczyński committed 2026-10-06 11:29:34 +02:00
1 parent cf25423dde
commit 52cc137c73
50 files changed
+410 -172

No files matched your search

+27
View File
@@ -34,6 +34,33 @@ mod tests {
assert_eq!(stats.generation, 1);
}
#[test]
fn generation_recycles_after_age_without_request() {
let backend = backend("rotation-age-test", 18083);
let mut keepalive = crate::balance::Keepalive::default();
keepalive.pool_recycle_requests = 0;
keepalive.pool_recycle_seconds = 1;
let client = client_with_keepalive(
&backend,
AddressPolicy::new(&backend).unwrap(),
false,
&keepalive,
)
.unwrap();
client
.inner
.generation_started_ms
.store(10, std::sync::atomic::Ordering::Relaxed);
client.inner.maintain_rotation_at(2_010);
let stats = client.rotation_stats();
assert_eq!(stats.rotations, 1);
assert_eq!(stats.generation, 1);
assert_eq!(stats.generation_requests, 0);
}
#[test]
fn generation_recycling_can_be_disabled() {
let backend = backend("rotation-off", 18082);