Skip to content

test: Try to fix row-count race in flaky EmbeddedKafkaSupervisorTest - #19581

Merged
abhishekrb19 merged 1 commit into
apache:masterfrom
amaechler:fix-flaky-embedded-kafka-supervisor
Jun 15, 2026
Merged

abhishekrb19 merged 1 commit into
apache:masterfrom
amaechler:fix-flaky-embedded-kafka-supervisor

Conversation

@amaechler

Copy link
Copy Markdown
Contributor

EmbeddedKafkaSupervisorTest.test_runKafkaSupervisor is flaky in CI:

EmbeddedKafkaSupervisorTest.test_runKafkaSupervisor:129 expected: <10> but was: <8>

(observed values 7–9 across retries)

The test produces 10 records, waits only for the broker to discover the datasource (the first matching metric event), then immediately asserts SELECT COUNT(*) == 10. Under a loaded CI runner the query races ingestion and observes fewer than 10 rows.

This adds a wait on ingest/events/processed reaching the expected count before the row-count assertion identical to what test_runSupervisor_withEmptyDimension in this file already uses.


This PR has:

  • been self-reviewed.

test_runKafkaSupervisor produced 10 records, waited only for the broker to
discover the datasource (the first matching metric event), then immediately
asserted SELECT COUNT(*) == 10. Under a loaded CI runner the query raced
ingestion and saw fewer than 10 rows (expected:<10> but was:<8/7/9>).

Wait for ingest/events/processed to reach the expected count before querying,
matching the sibling test_runSupervisor_withEmptyDimension, and derive the
expected count from expectedSegments instead of a hardcoded literal.
@abhishekrb19

Copy link
Copy Markdown
Contributor

Thanks @amaechler. Saw this test flake a few times recently in some recent PRs as well.

@abhishekrb19
abhishekrb19 merged commit 1ce8a30 into apache:master Jun 15, 2026
38 checks passed
@github-actions github-actions Bot added this to the 38.0.0 milestone Jun 15, 2026
@amaechler
amaechler deleted the fix-flaky-embedded-kafka-supervisor branch June 15, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants