Skip to content

KAFKA-16499: Make client metrics cache eviction test deterministic - #23041

Open
lh0156 wants to merge 1 commit into
apache:trunkfrom
lh0156:agent/KAFKA-16499-deterministic-cache-eviction
Open

KAFKA-16499: Make client metrics cache eviction test deterministic#23041
lh0156 wants to merge 1 commit into
apache:trunkfrom
lh0156:agent/KAFKA-16499-deterministic-cache-eviction

Conversation

@lh0156

@lh0156 lh0156 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

The client metrics cache eviction tests use a 300 ms preemptive timeout and a fixed 50 ms polling sleep while the SystemTimerReaper executes expiration tasks asynchronously. Under normal CI scheduling, the test can time out even though the timer task is progressing.

This change replaces the timing-sensitive loop with a shared wait helper based on Kafka's TestUtils.waitForCondition. The helper waits until both the timer queue and the expected client instances are drained, preserving the existing post-eviction metric and connection-map assertions.

Tests

  • ./gradlew :server:test --tests org.apache.kafka.server.ClientMetricsManagerTest
  • ./gradlew :server:spotlessCheck :server:checkstyleTest
  • git diff --check

Jira: https://issues.apache.org/jira/browse/KAFKA-16499

Wait for asynchronous reaper work with Kafka test utilities instead of a fixed preemptive timeout and polling sleep.

Generated-by: OpenAI Codex (GPT-5)
@github-actions github-actions Bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) small Small PRs labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Kafka Broker small Small PRs tests Test fixes (including flaky tests) triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant