Skip to content

chore(tailer): fix a flaky tests in tail/querier_test.go #18282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 30, 2025

Conversation

ashwanthgoli
Copy link
Contributor

@ashwanthgoli ashwanthgoli commented Jun 30, 2025

What this PR does / why we need it:

Mock TailDisconnectedIngesters calls to return empty clients map. This func gets called periodically from the tailer's loop, not implementing it could result in a panic

TestQuerier_concurrentTailLimits/ring_containing_one_active_ingester_and_0_active_tailers (0.00s)
panic:
        assert: mock: I don't know what to return because the method call was unexpected.
                Either do Mock.On("TailDisconnectedIngesters").Return(...) first, or remove the TailDisconnectedIngesters() call.
                This method was unexpected:
                        TailDisconnectedIngesters(*context.valueCtx,*logproto.TailRequest,[]string)
                        0: &context.valueCtx{Context:context.backgroundCtx{emptyCtx:context.emptyCtx{}}, key:0, val:"test"}
                        1: &logproto.TailRequest{Query: "{type=\"test\"}",
        DelayFor: 0x0,
        Limit: 0xa,
        Start: time.Date(2025, time.June, 30, 13, 10, 45, 569837000, time.Local),
        Plan: &plan.QueryPlan{AST:(*syntax.MatchersExpr)(0x14000e00c48)},
        }
                        2: []string{"ingester-1"}
                at: [/Users/grafana/Workspace/loki/pkg/querier/tail/tail_mock_test.go:29 /Users/grafana/Workspace/loki/pkg/querier/tail/querier.go:134 /Users/grafana/Workspace/loki/pkg/querier/tail/tail.go:189 /Users/grafana/Workspace/loki/pkg/querier/tail/tail.go:94 /opt/homebrew/Cellar/go/1.24.1/libexec/src/runtime/asm_arm64.s:1223]

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR
@ashwanthgoli ashwanthgoli requested a review from a team as a code owner June 30, 2025 10:21
@ashwanthgoli ashwanthgoli merged commit fc69dec into main Jun 30, 2025
66 checks passed
@ashwanthgoli ashwanthgoli deleted the fix-tailer-flaky-test branch June 30, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants