Skip to content

Add regression tests for five load balancing, pool and eviction behaviours - #1108

Open
Trenyx wants to merge 1 commit into
cloudflare:mainfrom
Trenyx:test/lb-pool-eviction
Open

Trenyx wants to merge 1 commit into
cloudflare:mainfrom
Trenyx:test/lb-pool-eviction

Conversation

@Trenyx

@Trenyx Trenyx commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Closes #1100

Tests only: five unit tests (+70 lines) in the existing test modules. No change to library code, no new dependencies.

Test What it pins down
tests::node_idx_wraps_past_last_point (pingora-ketama) A hash above the last ring point wraps to the first point
selection::consistent::test::test_ketama_honors_backend_weight (pingora-load-balancing) A weight 3 backend takes its weighted share of the ring
health_check::test::test_health_counter_restarts_after_flip (pingora-load-balancing) After a flip, flipping back takes the full threshold again
connection::tests::test_pool_node_remove_keeps_other_hot_queue_items (pingora-pool) PoolNode::remove keeps the items queued ahead of its target
eviction::lru::test::test_peek_does_not_promote (pingora-cache) peek leaves the eviction order alone, as EvictionManager::peek documents

How they were checked

On a copy at 1adcb38 (current main):

  • With the tests added to unchanged code, cargo fmt --all -- --check, cargo clippy --all-targets -p <crate> -- --allow=unknown-lints --deny=warnings and cargo test -p <crate> for the four crates all pass (pingora-ketama 7, pingora-load-balancing 81, pingora-pool 36 and pingora-cache 221 unit tests, including the new ones).
  • With each of the five bugs from the issue applied one at a time, exactly its matching test fails and every other test still passes.

These tests were written with Claude Code during a planted-bug run by SK @ Trenyx.

…iours

Unit tests only, no library change: ketama ring wrap past the last point,
KetamaHashing honoring backend weights, the health counter restarting
after a flip, PoolNode::remove keeping the other hot queue items, and
the LRU manager's peek leaving eviction order alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: five load balancing, pool and eviction behaviours the unit tests don't pin down

1 participant