tests: Fix flaky TestSingleClusterPartitionReader_ConsumeAtStartup - #16340
Open
56quarters wants to merge 1 commit into
Open
tests: Fix flaky TestSingleClusterPartitionReader_ConsumeAtStartup#1634056quarters wants to merge 1 commit into
56quarters wants to merge 1 commit into
Conversation
Fixes a flaky subtest of TestSingleClusterPartitionReader_ConsumeAtStartup that often failed with an unexpected context cancelled error. Avoid this by using the test context to control the producer thread and stopping it when the test ends. This avoids the producer thread trying to write with a cancelled context after the test has ended but before cleanup methods have run. Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
56quarters
marked this pull request as ready for review
August 10, 2026 23:09
tcp13equals2
approved these changes
Aug 11, 2026
karlskewes
approved these changes
Aug 11, 2026
karlskewes
left a comment
Contributor
There was a problem hiding this comment.
Nice, t.Context() is cancelled just before t.Cleanup(..) runs so the select unblocks.
Contributor
|
please rebase this PR on latest main, otherwise it can't merge — it's blocked on required checks that will never report. context: #16335 changed the unit test CI matrix and the required checks got renamed ( |
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.
What this PR does
Fixes a flaky subtest of TestSingleClusterPartitionReader_ConsumeAtStartup that often failed with an unexpected context cancelled error. Avoid this by using the test context to control the producer thread and stopping it when the test ends. This avoids the producer thread trying to write with a cancelled context after the test has ended but before cleanup methods have run.
Which issue(s) this PR fixes or relates to
N/A
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. If changelog entry is not needed, please add thechangelog-not-neededlabel to the PR.about-versioning.mdupdated with experimental features.