[9.3](backport #49228) filebeat: stabilize kafka input integration topic readiness#49273
Merged
[9.3](backport #49228) filebeat: stabilize kafka input integration topic readiness#49273
Conversation
Use a shared helper that creates and waits for a test topic to become writable before producing events. Apply it across kafka integration tests, including TestTest, to reduce leader-election race flakes. GenAI-Assisted: Yes Human-Reviewed: Yes Tool: GitHub Copilot CLI, Model: GPT-5.3 Codex --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co> (cherry picked from commit f6a7f39)
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
belimawr
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Summary
createReadyTestTopic(t)to centralize kafka test-topic setup and readiness waitingTestTestand the other topic-writing tests so they all avoid leader-election write races consistentlyWhy
TestTestflake reports show transientno leader for this partitionwrite errors. Other tests in the same file had the same write-on-fresh-topic pattern; this change applies the readiness guard uniformly.Validation
go test -tags=integration ./filebeat/input/kafka -run '^(TestInput|TestInputWithMultipleEvents|TestInputWithJsonPayload|TestInputWithJsonPayloadAndMultipleEvents|TestSASLAuthentication|TestTest)$' -count=1 -vconnect: connection refusedonlocalhost:9094), but the modified code path compiles and executes until environment connection.Fixes [Flaky Test] Kafka TestTest:
kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes#49206What is this? | From workflow: Mention in Issue
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
This is an automatic backport of pull request #49228 done by [Mergify](https://mergify.com).