Tests: five load balancing, pool and eviction behaviours the unit tests don't pin down
What is the problem your feature solves, or the need it fulfills?
A follow-up to #1035, on a different part of the code. We ran another planted-bug exercise on Pingora: in a private copy, we made one small, realistic change at a time and ran the existing tests. On current main (1adcb38), these five changes leave every test of the crate they touch passing:
pingora-ketama/src/lib.rs:VersionedRing::node_idxsends a hash above the last ring point to the last point instead of wrapping to the first, so those keys land on a different node than the code comment says.pingora-load-balancing/src/selection/consistent.rs:KetamaHashingbuilds every bucket with weight 1, so a weight 3 backend gets the same share of the ring as a weight 1 backend.pingora-load-balancing/src/health_check.rs:Health::observe_healthdoesn't clear the counter on a flip, so with a threshold above 1 a single opposite check flips the backend straight back.pingora-pool/src/connection.rs:PoolNode::removedrops the items it pops ahead of its target instead of putting them back, so removing one idle connection loses the others queued in front of it.pingora-cache/src/eviction/lru.rs:Manager::peekpromotes the asset, thoughEvictionManager::peeksays it shouldn't change the asset's popularity.
None of these bugs is in Pingora today. They are regressions the current tests would let through.
Describe the solution you'd like
One unit test per behaviour, in the existing test module of each file. Tests only: no change to library code, no new dependencies. I have them ready. Would you like a PR?
Additional context
We ran the tests of those four crates, not pingora-proxy's integration tests, which need OpenResty. If one of those already covers a case, I'll drop that test from the PR.
This was found with Claude Code during a planted-bug run by SK @ Trenyx.