diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go index 6627e9dcccc..d393d31beb4 100644 --- a/pkg/ingester/ingester_test.go +++ b/pkg/ingester/ingester_test.go @@ -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 diff --git a/pkg/ingester/lifecycle_test.go b/pkg/ingester/lifecycle_test.go index 7cb0ab825b0..29c59ab61f4 100644 --- a/pkg/ingester/lifecycle_test.go +++ b/pkg/ingester/lifecycle_test.go @@ -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