Skip to content

Commit

Permalink
test: Ensure ingester is active in ring before tests (#10528)
Browse files Browse the repository at this point in the history
Fix flake in TestIngester_PrepareInstanceRingDownscaleHandler when tests
were run before an ingester had actually joined the ring.

Signed-off-by: Nick Pillitteri <[email protected]>
  • Loading branch information
56quarters authored Jan 28, 2025
1 parent c6ad9c8 commit 0aeb211
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/ingester/downscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ func TestIngester_PrepareInstanceRingDownscaleHandler(t *testing.T) {
require.NoError(t, services.StopAndAwaitTerminated(context.Background(), i))
})

// Wait until it's healthy
test.Poll(t, 5*time.Second, 1, func() interface{} {
return i.lifecycler.HealthyInstancesCount()
})
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

// Tests require that we've joined the ring so ensure that here.
require.NoError(t, ring.WaitInstanceState(ctx, ingestersRing, cfg.IngesterRing.InstanceID, ring.ACTIVE))
}

return i, ingestersRing
Expand Down

0 comments on commit 0aeb211

Please sign in to comment.