Skip to content

Commit

Permalink
Fix metadata ingestion test flake (#7988)
Browse files Browse the repository at this point in the history
This change fixes a metadata ingestion test flake caused by metadata being
ingested when it should have been rejected. The conversion of global to local
limits only counts the number of ingesters with tokens when determining how
to divide the global limit. When there are no ingesters with tokens due to
race conditions, 0 is used for the global limit which causes 0 to be used for
the local limit which is interpreted as "unlimited".

Fixes #7979

Signed-off-by: Nick Pillitteri <[email protected]>
  • Loading branch information
56quarters authored Apr 26, 2024
1 parent 48fafc8 commit 748a726
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2549,9 +2549,10 @@ func TestIngester_Push(t *testing.T) {

ctx := user.InjectOrgID(context.Background(), userID)

// Wait until the ingester is healthy
test.Poll(t, 100*time.Millisecond, 1, func() interface{} {
return i.lifecycler.HealthyInstancesCount()
// Wait until the ingester is healthy and owns tokens. Note that the timeout here is set
// such that it is longer than the MinReadyDuration configuration for the ingester ring.
test.Poll(t, time.Second, nil, func() interface{} {
return i.lifecycler.CheckReady(context.Background())
})

// Push timeseries
Expand Down
1 change: 1 addition & 0 deletions pkg/ingester/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func defaultIngesterTestConfig(t testing.TB) Config {
cfg.IngesterRing.InstanceAddr = "localhost"
cfg.IngesterRing.InstanceID = "localhost"
cfg.IngesterRing.FinalSleep = 0
cfg.IngesterRing.MinReadyDuration = 100 * time.Millisecond
cfg.ActiveSeriesMetrics.Enabled = true

return cfg
Expand Down

0 comments on commit 748a726

Please sign in to comment.