Fix flaky tests: port in for loki source api tests and logs integration test#4875
Merged
Fix flaky tests: port in for loki source api tests and logs integration test#4875
Conversation
ptodev
approved these changes
Nov 18, 2025
jharvey10
pushed a commit
that referenced
this pull request
Nov 18, 2025
…on test (#4875) * Fix port in use flakyness for loki source api tests * Pin loki container version for integration tests
Merged
jharvey10
added a commit
that referenced
this pull request
Nov 19, 2025
* fix: no longer drop request if stream is dropped in loki.source.api (#4834) * fix: add ForceShutdown that will cancel in-flight requests before stopping server * Split into multiple files and add LogsBatchReceiver * don't drop request when relabel rules drops a specific stream * fix: use loki.LogsBatchReceiver to ensure all entries in a request is sent down the pipeline * add changelog * add checks for entries and use sync once to close channel * update changelog for next rc * Fix flaky tests: port in for loki source api tests and logs integration test (#4875) * Fix port in use flakyness for loki source api tests * Pin loki container version for integration tests * Add a new mimir.alerts.kubernetes component (#3448) * Add a new mimir.alerts.kubernetes component * Sync Mimir periodically, test the case of a CRD deletion * Add TODOs * Longer test timeout * Check if pods are running * Apply suggestions from code review Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Fix metric doc * Fix changelog --------- Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Remove experimental flag from stage.windowsevent (#4879) --------- Co-authored-by: Karl Persson <23356117+kalleep@users.noreply.github.com> Co-authored-by: Kyle Eckhart <kgeckhart@users.noreply.github.com> Co-authored-by: Paulin Todev <paulin.todev@gmail.com> Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
dehaansa
pushed a commit
to madhub/alloy
that referenced
this pull request
Dec 10, 2025
…on test (grafana#4875) * Fix port in use flakyness for loki source api tests * Pin loki container version for integration tests
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR Description
Fix issues from port's being in used when testing loki source api by using random ports assigned by the server unless absolutely necessary. Since there's only 1 place we absolutely need a non-random port the likelihood we hit port in use is significantly reduced. The free port function is a race condition, we ask for a free port and release it before the server can claim it making it an option for another test to find as a free port.
Before this change all it took was 5 iterations to get it to fail locally through,
and with the change
count 500caused no issues.Pins the version we use for the Loki container in integration-tests so CI won't be testing with version of Loki we will not be using locally. We currently pin our other database dependencies as well.
PR Checklist